Merge lp:~openerp-dev/openobject-server/7.0-opw-593029-msh into lp:openobject-server/7.0
Proposed by
Mohammed Shekha(Open ERP)
Status: | Needs review |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-server/7.0-opw-593029-msh |
Merge into: | lp:openobject-server/7.0 |
Diff against target: |
74 lines (+18/-11) 4 files modified
openerp/addons/base/module/wizard/base_export_language.py (+1/-1) openerp/addons/base/module/wizard/base_update_translations.py (+1/-1) openerp/osv/orm.py (+9/-7) openerp/tools/translate.py (+7/-2) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-server/7.0-opw-593029-msh |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Olivier Dony (Odoo) | Disapprove | ||
Martin Trigaux (OpenERP) | Pending | ||
Naresh(OpenERP) | Pending | ||
Review via email: mp+166438@code.launchpad.net |
Description of the change
Hello,
Fixed the issue of tranlation of selection field when there is callable instead of list of tuple.
Demo:- Go to Project form and see there privacy_visisbility field which is selection field, this selection field is never going to be translated as there is callable function instead of list of tuple values.
So fixed if from fields_get and from trans_generate.
Thanks.
To post a comment you must log in.
Unmerged revisions
- 4990. By Mohammed Shekha<email address hidden>
-
[FIX]Fixed the issue of tranlation of selection field when there is callable instead of list of tuple.
I don't think we should change the behavior of the translation system for callable selection fields:
- in the API, when we have static strings we translate them automatically, but when we have callables they are responsible for translating their result. This is the case for the message of _constraints for example: if static it is translated, if callable it is not.
- in many cases the callables will read data from the database (e.g. a list of records), and if the results need to be translated it will already be done (with correct context lang)
- when exporting translations, if we take all results from callables we will have a lot of invalid/incorrect values that will pollute the POT files
Instead the right thing to do would be to fix the callable to make it return translated values correctly:
return [('public', _('All Users')),
('employees' , _('Employees Only')),
('followers' , _('Followers Only'))]
Thanks!