Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3697 Lượt xem

i want to add a pdf report to res.partner model 

i'have proceed this way;

<odoo>


    <report

        id="report_user"

        model="res.partner"

        string="Partner Report"

        name="res.partner.report_partner_view"

        file="res.partner.report_partner"

        report_type="qweb-pdf" />


        <template id="report_partner_view">

            <t t-call="web.html_container">

                <t t-foreach="docs" t-as="o">

                    <t t-call="web.external_layout">

                        <t t-set="address">

                            <address t-field="o.id" 

                                    t-options='{"widget": "contact", "fields": ["name", "email", "phone"]}'/>

                        </t>

                        <div class="page">

                            

                        </div>

                    </t>

                </t>

            </t>

        </template>

</odoo>


but i get this error when i click on the print button which indicates that the system couldnt find the extenal id mentioned in the xml file,



 File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1670, in xmlid_lookup raise ValueError('External ID not found in the system: %s' % xmlid) ValueError: External ID not found in the system: res.partner.report_partner_view


i don't know why the system considers the tag "name" as an external id, and not just a human read able nomination tag, was there changes on the version 13 that i am not taking in consideration  ?  


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

What is your module name actually ?
Instead of giving like this,  name="res.partner.report_partner_view" inside the report tag, try like this and see,

name="report_partner_view" or name="custom_module_namereport_partner_view"


Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

the name of the module is "profile", and i declared a class in where i inherite the res.partner module :

    class extend_contact(models.Model):

    _inherit='res.partner'

    def print_page(self):

        return self.env.ref('print_contact.action_report_page').report_action(self)


i changed my code to be like this time :



    <report

        id="report_user"

        model="res.partner"

        string="Partner Report"

        name="profile.res_partner_form"

file="profile.res_partner"

        report_type="qweb-pdf" />


but still got the same error 


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 24
2830
3
thg 4 24
5974
0
thg 7 22
1300
0
thg 8 21
3397
1
thg 7 21
4369