Merge lp:~openerp-dev/openerp-web/trunk-ilfautdirenonalapropagation-niv into lp:openerp-web

Proposed by Nicolas Vanhoren (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/trunk-ilfautdirenonalapropagation-niv
Merge into: lp:openerp-web
Diff against target: 44 lines (+6/-6)
3 files modified
addons/web/static/src/js/corelib.js (+4/-0)
addons/web/static/src/js/view_form.js (+1/-5)
addons/web/static/src/js/views.js (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/trunk-ilfautdirenonalapropagation-niv
Reviewer Review Type Date Requested Status
OpenERP R&D Web Team Pending
Review via email: mp+129124@code.launchpad.net

Description of the change

Stops context propagation when we click on a button in a form view.

To post a comment you must log in.
3190. By Nicolas Vanhoren (OpenERP)

[IMP] now uses py.eval for options

Revision history for this message
Christophe Matthieu (OpenERP) (chm-openerp) wrote :

This branch have a good name ^^

Unmerged revisions

3190. By Nicolas Vanhoren (OpenERP)

[IMP] now uses py.eval for options

3189. By Nicolas Vanhoren (OpenERP)

merge trunk

3188. By Nicolas Vanhoren (OpenERP)

merge trunk

3187. By Nicolas Vanhoren (OpenERP)

Removed propagation of contexts

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/corelib.js'
2--- addons/web/static/src/js/corelib.js 2012-10-11 00:37:29 +0000
3+++ addons/web/static/src/js/corelib.js 2012-10-11 12:23:20 +0000
4@@ -1440,6 +1440,10 @@
5 },
6 });
7
8+instance.web.py_eval = function(expr, context) {
9+ return py.eval(expr, _.extend({}, context || {}, {"true": true, "false": false, "null": null}));
10+};
11+
12 }
13
14 // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
15
16=== modified file 'addons/web/static/src/js/view_form.js'
17--- addons/web/static/src/js/view_form.js 2012-10-11 00:37:29 +0000
18+++ addons/web/static/src/js/view_form.js 2012-10-11 12:23:20 +0000
19@@ -2087,11 +2087,7 @@
20 this.field = this.field_manager.get_field_desc(this.name);
21 this.widget = this.node.attrs.widget;
22 this.string = this.node.attrs.string || this.field.string || this.name;
23- try {
24- this.options = JSON.parse(this.node.attrs.options || '{}');
25- } catch (e) {
26- throw new Error(_.str.sprintf(_t("Widget options for field '%s' are not valid JSON."), this.name));
27- }
28+ this.options = instance.web.py_eval(this.node.attrs.options || '{}');
29 this.set({'value': false});
30
31 this.on("change:value", this, function() {
32
33=== modified file 'addons/web/static/src/js/views.js'
34--- addons/web/static/src/js/views.js 2012-10-10 11:30:25 +0000
35+++ addons/web/static/src/js/views.js 2012-10-11 12:23:20 +0000
36@@ -1177,7 +1177,7 @@
37 return self.getParent().on_action_executed.apply(null, arguments);
38 }
39 };
40- var context = new instance.web.CompoundContext(dataset.get_context(), action_data.context || {});
41+ var context = new instance.web.CompoundContext(action_data.context || {});
42
43 var handler = function (r) {
44 var action = r;