Created
December 4, 2013 15:48
-
-
Save rvalyi/7789846 to your computer and use it in GitHub Desktop.
kind of kwargs passing for OpenERP on_change: with an extension like <xpath expr="//field[@name='product_id']" position="attributes"> <attribute name="context_exta">{'my_extra_param': my_extra_field}</attribute></xpath> context_exta will be injected into field context, which can be used in on_change to receive extra params without having to chan…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js | |
index 062c746..ccf1c9a 100644 | |
--- a/addons/web/static/src/js/view_form.js | |
+++ b/addons/web/static/src/js/view_form.js | |
@@ -1869,15 +1869,33 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi | |
*/ | |
build_context: function() { | |
// only use the model's context if there is not context on the node | |
- var v_context = this.node.attrs.context; | |
+// var v_context = this.node.attrs.context; | |
+var v_context = false; | |
+var fields_values = false; | |
+console.log(this.node.attrs); | |
+for (var key in this.node.attrs) { | |
+ if (key.substring(0, 7) == "context") { | |
+ if (!v_context) { | |
+ fields_values = this.field_manager.build_eval_context(); | |
+ v_context = new instance.web.CompoundContext(this.node.attrs[key]).set_eval_context(fields_values); | |
+ console.log("first", v_context) | |
+ } else { | |
+ v_context = new instance.web.CompoundContext(this.node.attrs[key], v_context).set_eval_context(fields_values); | |
+ console.log("extension", v_context) | |
+ } | |
+ | |
+ } | |
+} | |
if (! v_context) { | |
v_context = (this.field || {}).context || {}; | |
} | |
- | |
+/* | |
if (v_context.__ref || true) { //TODO: remove true | |
var fields_values = this.field_manager.build_eval_context(); | |
v_context = new instance.web.CompoundContext(v_context).set_eval_context(fields_values); | |
} | |
+ console.log("ressssss", v_context) | |
+*/ | |
return v_context; | |
}, | |
build_domain: function() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment