Search code examples
xmlodoo-8odoo

Report missing translation because of Xpath


original report is this one and i want to override it with my new one.

<openerp>
    <data>
        <template id="report_invoice_qweb">
            <t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
            <div class="page">
                <div>

i try to use

 <data>
          <template id="report_invoice_inherit" inherit_id="account.report_invoice_qweb">

        <xpath expr="div[@class='page']" position="replace">

but the problem that my new report not having translation in it. because it's missing

<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />

how can i fix this problem.


Solution

  • The line <t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" /> is still in report_invoice_qweb, you haven't modified or removed that, so I guess that's not the problem. I mean that after your modifications the new account report will be like this:

    <openerp>
        <data>
            <template id="report_invoice_qweb">
                <t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
                <div class="page">  <!-- (YOUR CUSTOM div class="page") --> 
                   ... your code ...
                </div>
            </template>
        </data>
    </openerp>
    

    I think that the issue is that you haven't exported the translation of your module to your language and the new content of the <div class="page"> is not translated yet.

    So the solution is going to Settings > Translations > Import / Export > Export Translation, choosing your module and your language and editing the generated .po file (or .csv) to translate the terms added by you.