From c6395331e7ec424db461f5801fd337e7a6b15586 Mon Sep 17 00:00:00 2001 From: Pierre Verkest Date: Wed, 15 Jul 2015 23:28:13 +0200 Subject: [PATCH] combine context, Get windows_action context in BufferedDataSet Class --- web_readonly_bypass/README.rst | 9 ++++----- web_readonly_bypass/static/src/js/readonly_bypass.js | 12 ++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/web_readonly_bypass/README.rst b/web_readonly_bypass/README.rst index 79815358..ce17c316 100644 --- a/web_readonly_bypass/README.rst +++ b/web_readonly_bypass/README.rst @@ -10,7 +10,8 @@ saving onchange modifications to readonly fields. Behavior: add readonly fields changed by `on_change` methods to the values passed to write or create. If `readonly_by_pass` is in the context and -True then by pass readonly fields and save its change. +True then it will by pass readonly fields and save its data provide by onchange +method. Installation ============ @@ -35,7 +36,7 @@ To change that behavior you have to set context on ``ur.actions.act_window``:: {'readonly_by_pass': True} -or by telling fields allow to change:: +or by telling fields allowed to change:: @@ -50,9 +51,7 @@ For further information, please visit: Known issues / Roadmap ====================== - * At this point, bypass on a field on o2m field (like field on sale order line) - are not working, because context from action is not take on consideration - when loosing focus on the line in the ``BufferedDataSet`` js Class. + * Bug Tracker =========== diff --git a/web_readonly_bypass/static/src/js/readonly_bypass.js b/web_readonly_bypass/static/src/js/readonly_bypass.js index aa40a0d3..6ba51ce9 100644 --- a/web_readonly_bypass/static/src/js/readonly_bypass.js +++ b/web_readonly_bypass/static/src/js/readonly_bypass.js @@ -21,11 +21,8 @@ openerp.web_readonly_bypass = function(instance) { * @param {Object} context->readonly_by_pass */ ignore_readonly: function(data, options, mode, context){ - console.log(options ); - console.log(context ); var readonly_by_pass_fields = this.retrieve_readonly_by_pass_fields( options, context); - console.log(readonly_by_pass_fields ); if(mode){ $.each( readonly_by_pass_fields, function( key, value ) { if(value==false){ @@ -34,7 +31,6 @@ openerp.web_readonly_bypass = function(instance) { }); } data = $.extend(data,readonly_by_pass_fields); - console.log(data ); }, /** @@ -85,7 +81,9 @@ openerp.web_readonly_bypass = function(instance) { */ create : function(data, options) { var self = this; - readonly_bypass.ignore_readonly(data, options, true, self.context); + var context = instance.web.pyeval.eval('contexts', + self.context.__eval_context); + readonly_bypass.ignore_readonly(data, options, true, context); return self._super(data,options); }, /** @@ -99,7 +97,9 @@ openerp.web_readonly_bypass = function(instance) { */ write : function(id, data, options) { var self = this; - readonly_bypass.ignore_readonly(data, options, false, self.context); + var context = instance.web.pyeval.eval('contexts', + self.context.__eval_context); + readonly_bypass.ignore_readonly(data, options, false, context); return self._super(id,data,options); },