po translations for the same text occurring in different aeroo reports are not loaded

Bug #1333037 reported by Anton Chepurov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Aeroo Reports
New
Undecided
Unassigned

Bug Description

If there are 2 or more aeroo reports featuring the same translatable text and a correct po file with translations (e.g.:

#. module: my_module
#: report:ir.actions.report.xml:my_module.report1_xml_id
#: report:ir.actions.report.xml:my_module.report2_xml_id
msgid "Invoice"
msgstr "<Invoice_in_some_other_language>"

), then only the first report (report1_xml_id) will have its translation imported.

This happens both at normal module update and at manual translations import (from menu Settings > Translations > Import/Export > Import Translation).

==========================

Reason:
/server/openerp/addons/base/ir/ir_translation.py:
        ir_translation_import_cursor#finish(): find_expr

When looking for existing translations to match those being imported, variable find_expr considers res_id for comparison only when the record is of type=='model'.
Since aeroo reports should also be compared by res_id, the correct find_expr should be:

         find_expr = "irt.lang = ti.lang AND irt.type = ti.type " \
                     " AND irt.name = ti.name AND irt.src = ti.src " \
- " AND (ti.type != 'model' OR ti.res_id = irt.res_id) "
+ " AND (ti.type NOT IN ('model','report') OR ti.res_id = irt.res_id) "

I couldn't manage to fix this part of ir_translation.py from inside of my own module (i.e. non-intrusively), so had to introduce this change into the server part.

It would be great if anybody had an idea of how this change could be introduced into the aeroo module, instead of touching the server side. Of course, if this solution is correct.

GitHub bug: https://github.com/odoo/odoo/issues/711

Tags: po translation
description: updated
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.