Review: Needs Fixing
It looks good to me, even though the code is not pretty, it's rather on par
with the existing one ;-)
One thing does not look right: the hack to match translate() calls within RML
expressions, l.103-109. It's done in a brittle manner (the regex may not match
what you think) and introduce a new semantics that we did not intend to support.
Instead of patching the server this way, we should use the current system for
translation text within RML documents. There are 2 options for dynamically
deciding the text to include in RML para, and both are already used in the
addons:
1. Put multiple variations of the paragraph next to each other, and add a [[ ]]
expression calling removeParentNode('para') for the paragraph that should not
be displayed.
For example instead of doing this:
<td><para style="terp_tblheader_General_Centre">[[
data['model']=='account.journal.period' and translate('Company') or
translate('Chart of Accounts')]]</para>
We can do this instead, taking the string outside of the [[]] expression:
<para style="terp_tblheader_General_Centre">Company
[[data['model']=='account.journal.period' and '' or
removeParentNode('para')]]</para></td>
<para style="terp_tblheader_General_Centre">Chart of Accounts
[[data['model']=='ir.ui.menu' and '' or removeParentNode('para')]]</para></td>
2. Alternatively, delegate the computation of the label to the Python code in
the report parser, which would use the _() method to properly translate (and
export). For example:
<para style="terp_tblheader_General_Centre">[[get_label(data)]]</para></td>
+ an appropriate get_label() method in the report parser.
Using one of these 2 techniques is better than introducing a third (and
brittle) way of translating RML strings.
BTW, whenever we modify existing .rml files we should adapt the corresponding
.sxw file if it exists, so it contains the same change.
Thanks!
--
https://code.launchpad.net/~openerp-dev/openobject-server/6.1-opw-577045-cbi/+merge/126173
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-server/6.1-opw-577045-cbi.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp