Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Odoo10 QWeb issues with translation

by
Mohamed M. Hagag
- 05/02/2018 20:52:50

Hi All,

We are facing many issues with Odoo 10 and language translation, one of them is that when we inherit a qweb report view and add fields using the xpath node text - which is in English - the new view works fine in English but in other language the system says that the node does not exist in the parent view - due to change of the text because of translation .

example code:

new view:

<xpath expr="//th[.='Unit Price']" position="after">
                <th t-att-style="style" t-if="display_discount and doc.show_discount and doc.show_price" class="text-right" groups="sale.group_discount_per_so_line">Total</th>
            </xpath>

in Arabic generates below error

ValueError: Element '<xpath expr="//th[.='Unit Price']">' cannot be located in parent view -- because 'Unit price' translated to other string.


And I must select nodes by text not by index due to other inherit views that change the index and the node does not have id or other selector.


Another Issue with translated error messages generates errors like: 

File "/opt/O10/odoo/odoo/odoo/addons/base/ir/ir_ui_view.py", line 595, in apply_inheritance_specs
    self.raise_view_error(_("Element '%s' cannot be located in parent view") % tag, inherit_id)
TypeError: not all arguments converted during string formatting

This error because the previous error message - ValueError: Element ...etc - have been translated and the system can not load the utf-8 translation.


Note: I tried both cases on runbot.odoo.com v10 build community and enterprise and got the same errors.


This doesn't happen in Odoo v8.0 and everything related to translation/utf8 is working fine.
 
can anyone explain what have technically changed in Odoo 10 related to translation handling and UTF-8 string formatting ?

Does Odoo10 translate strings before apply_inheritance on views ?? and why ? 

should Odoo10 adapt the new string.format() instead of using % as some developers claims that the later causes issues with UTF in latest python versions ?


System specs:

1- one server is ubuntu 16.04 with python 2.7.13 and postgres 9.6 
2- the other one is debian 9 with python 2.7.13 and postgres 9.6

Also I tried Centos7 with python 2.7.5/6 and postgres 9.4 << this generates same errors and more.


Any help is so appreciated.


Regards,

Follow-Ups