Merge lp:~unifield-team/unifield-web/web_oeb_174 into lp:unifield-web

Proposed by Xavier ALT
Status: Merged
Merged at revision: 4726
Proposed branch: lp:~unifield-team/unifield-web/web_oeb_174
Merge into: lp:unifield-web
Diff against target: 106 lines (+22/-35)
3 files modified
addons/openerp/static/javascript/listgrid.js (+6/-1)
addons/openerp/static/javascript/m2m.js (+16/-3)
addons/openerp/widgets/listgrid.py (+0/-31)
To merge this branch: bzr merge lp:~unifield-team/unifield-web/web_oeb_174
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+157606@code.launchpad.net

Description of the change

Hi,

This fix OEB-174, by backport r4892 [1] of upstream web v6.0 branch.

This remove the non-sense default_get() from server-side to move it to client-side - allowing correct evaluation of parents value.

Regards,
Xavier

References:
[1] http://bazaar.launchpad.net/~openerp/openobject-client-web/6.0/revision/4892

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/openerp/static/javascript/listgrid.js'
2--- addons/openerp/static/javascript/listgrid.js 2012-03-14 17:30:39 +0000
3+++ addons/openerp/static/javascript/listgrid.js 2013-04-08 08:56:26 +0000
4@@ -849,7 +849,12 @@
5 $editors.each(function () {
6 var $this = jQuery(this);
7 if ($this.val() && $this.attr('callback')) {
8- MochiKit.Signal.signal(this, 'onchange');
9+ if (($this.attr('kind') == 'many2one' && $this.attr('id').slice($this.attr('id').length - 5) == '_text')
10+ || ($this.attr('kind') == 'many2many' && $this.attr('id').slice($this.attr('id').length - 4) == '_set')) {
11+ // skip many2x 'text' element, onchange will be triggered from real many2x field
12+ return;
13+ }
14+ $this.trigger('change');
15 }
16 });
17 }
18
19=== modified file 'addons/openerp/static/javascript/m2m.js'
20--- addons/openerp/static/javascript/m2m.js 2012-03-23 06:58:03 +0000
21+++ addons/openerp/static/javascript/m2m.js 2013-04-08 08:56:26 +0000
22@@ -72,10 +72,22 @@
23
24 // save the reference
25 openobject.dom.get(name)._m2m = this;
26+
27+ var $this = jQuery(idSelector('_m2m_' + name));
28+ var $list = jQuery(idSelector(name));
29+ $list.attr({
30+ 'callback': $this.attr('callback'),
31+ 'change_default': $this.attr('change_default')
32+ });
33+ $list.bind('before-redisplay.m2m', function () {
34+ // calls form.js onChange()
35+ onChange(name);
36+ });
37+
38 },
39
40 onChange: function() {
41- this.setValue(this.id.value);
42+ this.setValue(this.id.value, {'no_onchange': true});
43 },
44
45 selectAll: function() {
46@@ -84,7 +96,8 @@
47 }
48 },
49
50- setValue: function(ids) {
51+ setValue: function(ids, options) {
52+ var options = options || {};
53 ids = /^\[.*\]/.test(ids) ? ids : '[' + ids + ']';
54 ids = eval(ids);
55
56@@ -97,7 +110,7 @@
57 jQuery(idSelector(this.name)).val(ids);
58 }
59
60- if ($id.attr('callback')) {
61+ if ($id.attr('callback') && !options.no_onchange) {
62 onChange(this.id);
63 }
64 // Mark form as changed so save alert can appear
65
66=== modified file 'addons/openerp/widgets/listgrid.py'
67--- addons/openerp/widgets/listgrid.py 2013-03-13 08:15:04 +0000
68+++ addons/openerp/widgets/listgrid.py 2013-04-08 08:56:26 +0000
69@@ -369,37 +369,6 @@
70 values[field] = value
71 elif operator == 'in' and len(value) == 1:
72 values[field] = value[0]
73-
74- #call on_change methods
75- headers_index = dict([(item[0], item[1]) for item in self.headers])
76- to_check = values.keys()
77- for field_name in to_check:
78- if not field_name in headers_index:
79- continue
80- props = headers_index[field_name]
81- if not "on_change" in props:
82- continue
83- on_change_method = props["on_change"]
84-
85- match = re.match('^(.*?)\((.*)\)$', on_change_method)
86- if not match:
87- raise common.error(_('Application Error'), _('Wrong on_change trigger'))
88- func_name = match.group(1)
89- arg_names = [n.strip() for n in match.group(2).split(',')]
90-
91- args = [values[arg] if arg in values else False for arg in arg_names]
92-
93- proxy = rpc.RPCProxy(self.model)
94- response = getattr(proxy, func_name)([], *args)
95- if response is False:
96- response = {}
97- if 'value' not in response:
98- response['value'] = {}
99-
100- new_values = response["value"]
101- for k, v in new_values.items():
102- if k not in values or values[k] != v:
103- values[k] = v
104
105 for f in fields:
106 if f in values:

Subscribers

People subscribed via source and target branches

to all changes: