Browse Source

combine context,

Get windows_action context in BufferedDataSet Class
pull/164/head
Pierre Verkest 9 years ago
parent
commit
c6395331e7
  1. 9
      web_readonly_bypass/README.rst
  2. 12
      web_readonly_bypass/static/src/js/readonly_bypass.js

9
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``::
<field name="context">{'readonly_by_pass': True}</field>
</record>
or by telling fields allow to change::
or by telling fields allowed to change::
<record id="sale.action_quotations" model="ir.actions.act_window">
<field name="context">
@ -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
===========

12
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);
},

Loading…
Cancel
Save