Merge lp:~openerp-dev/openerp-web/7.0-ticket-604115-jam into lp:openerp-web/7.0

Proposed by Jigar A.
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-ticket-604115-jam
Merge into: lp:openerp-web/7.0
Diff against target: 30 lines (+3/-3)
1 file modified
addons/web/static/src/js/view_list.js (+3/-3)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-ticket-604115-jam
Reviewer Review Type Date Requested Status
Sandy Carter (http://www.savoirfairelinux.com) (community) code review, test Needs Fixing
OpenERP Core Team Pending
Review via email: mp+206540@code.launchpad.net

Description of the change

Many2many fields in Tree views will not get translated. If you check the context for a name_get of a m2m field, it is passed as None. Same i sthe case for many2one and reference fields.
Courtesy : Sandy Carter (http://www.savoirfairelinux.com), MSH
Thanks

To post a comment you must log in.
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) :
review: Approve (code review, test)
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

Getting this error while using this patch at revno 4144.
Does not appear at revno 4143

Client Traceback (most recent call last):
  File "web/addons/web/http.py", line 197, in dispatch
    self.jsonrequest = simplejson.load(requestf, object_hook=reject_nonliteral)
  File "/usr/lib/python2.7/site-packages/simplejson/__init__.py", line 431, in load
    use_decimal=use_decimal, **kw)
  File "/usr/lib/python2.7/site-packages/simplejson/__init__.py", line 505, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/usr/lib/python2.7/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python2.7/site-packages/simplejson/decoder.py", line 389, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
  File "web/addons/web/http.py", line 125, in reject_nonliteral
    "Non literal contexts can not be sent to the server anymore (%r)" % (dct,))
ValueError: Non literal contexts can not be sent to the server anymore ({'__ref': 'compound_context', '__contexts': [{'lang': 'fr_FR', 'tz': 'Europe/Brussels', 'uid': 1}, {'lang': 'fr_FR', 'tz': 'Europe/Brussels', 'uid': 1}, {}], '__eval_context': None})

review: Needs Fixing (code review, test)

Unmerged revisions

4144. By Jigar A.

[FIX] Added Missing Context for M2O and Reference Fields, To enable i18n. courtesy : MSH

4143. By Sandy Carter (http://www.savoirfairelinux.com)

[FIX] Added MIssing Context for M2M, To enable i18n.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/js/view_list.js'
2--- addons/web/static/src/js/view_list.js 2014-01-15 11:00:38 +0000
3+++ addons/web/static/src/js/view_list.js 2014-02-14 17:47:15 +0000
4@@ -1020,7 +1020,7 @@
5 // to get a correctly displayable value in the field
6 var model = ref_match[1],
7 id = parseInt(ref_match[2], 10);
8- new instance.web.DataSet(this.view, model).name_get([id]).done(function(names) {
9+ new instance.web.DataSet(this.view, model).name_get([id, this.dataset.context]).done(function(names) {
10 if (!names.length) { return; }
11 record.set(column.id + '__display', names[0][1]);
12 });
13@@ -1036,7 +1036,7 @@
14 // and let the various registered events handle refreshing the
15 // row
16 new instance.web.DataSet(this.view, column.relation)
17- .name_get([value]).done(function (names) {
18+ .name_get([value, this.dataset.context]).done(function (names) {
19 if (!names.length) { return; }
20 record.set(column.id, names[0]);
21 });
22@@ -1060,7 +1060,7 @@
23 ids = value;
24 }
25 new instance.web.Model(column.relation)
26- .call('name_get', [ids]).done(function (names) {
27+ .call('name_get', [ids, this.dataset.context]).done(function (names) {
28 // FIXME: nth horrible hack in this poor listview
29 record.set(column.id + '__display',
30 _(names).pluck(1).join(', '));