webkit_report : setLang() doesn't work!

Bug #897412 reported by Serpent Consulting Services
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

In the webkit report, the setLang() is not working as per the standard.

Reason : Normal reports work fine because setLang() assigns the context to the objects fetched from getObjects(). While in webkit, we call different parser for report engine, setLang is part of i t and 2nd parser is th class which is defined for report.

To get an effect of setLang(), you would normally need to do this:

In the definition of your parser(report class),override set_context and do something like:

def set_context(self, objects, data, ids, report_type=None):
        for ob in objects:
            ob._context['lang'] = ob.lang
        super call

If you do this, the header, footer and body will have an impact of new lang all over.

If in case,you dont' do this, nothing gets translated.

As a solution on global level, you would opt to follow what normal parser does, its in the attached patch.

Hope this really helps.

Correct me if I have mistaken.

Thanks,
Serpent Consulting Services.

Related branches

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :
Amit Parik (amit-parik)
Changed in openobject-addons:
assignee: nobody → Nicolas Bessi - Camptocamp (nbessi-c2c)
Revision history for this message
Ferdinand (office-chricar) wrote :

IMHO the problem comes from another issue

the translation for webkit reports stores the the terms with
name = report_file
   instead
name = report_name in ir_translation
whereas the runtime translation routine searches for report_name to find the translation - which IMHO is correct.

after running

 update ir_translation set name ='report.account.invoice.webkit' where name = 'account_invoice_webkit/report/account_invoice_webkit.mako';

the translations works

Changed in openobject-addons:
status: New → Confirmed
Revision history for this message
Ferdinand (office-chricar) wrote :

the problem is already in the po file

#. module: account_invoice_webkit
#: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:237
msgid "Total Tax:"
msgstr "Gesamt Steuern:"

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

I will have a look, but there is effectively a regression in 6.0.3

 will fix it next week

Regards

Nicolas

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

We have two different bugs here,
One that affect setLang (in stable only) for translatable value (in form),

And on that break static translation in mako in trunk by affecting break export/synchronize translation.

Here I'll focus on fixing stable translation issues. I will open an other ticket for translation wizard issue.

Regards

Nicolas

Changed in openobject-addons:
status: Confirmed → Fix Released
Revision history for this message
Jean-Marc Vandel (jmv) wrote :

Where is the fix ? What is the ID of the wizard bug ?

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

FYI from odo-openerp

J'ai corrigé ce problème de nom de fichier à la revision 6364 dans
addons trunk, pour le reproduire il suffisait e.g. d'installer le
Hongrois et de l'assigner comme langue a un partenaire, puis d'imprimer
une "Webkit invoice" pour ce partneraire.

Le second problème pour le lookup des traductions (correspondant au bug
819334
est corrigé à la révision 6365 avec un patch d'une ligne (cfr le
message de commit pour les explications)

Je vais aussi backporter ces fix dans la 6.0, puisque nous avons eu des
demandes OPW a ce sujet.

Bonne journée!

Revision history for this message
Allen Wyma (allen-wyma) wrote :

So has this fix been confirmed or not? I need to print out some reports with products names in Chinese and in English on the same report. I make calls like this:

                                         <% setLang('en_CA') %>
      ${line.product_id.name or ''|entity}<br />
     <% setLang('zh_HK') %>
     <b>${line.product_id.name or ''|entity}</b>

But both names keep coming up in English. This is the same fix, right?

Revision history for this message
Mathieu Benoit (mathben) wrote :

I have the same bogue with openerp 7, do you have a solution?
The translated field of model keep english, but the static text do the translation.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.