mirror of https://github.com/OCA/web.git
parent
d650d93a69
commit
c6395331e7
|
@ -10,7 +10,8 @@ saving onchange modifications to readonly fields.
|
||||||
|
|
||||||
Behavior: add readonly fields changed by `on_change` methods to the values
|
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
|
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
|
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>
|
<field name="context">{'readonly_by_pass': True}</field>
|
||||||
</record>
|
</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">
|
<record id="sale.action_quotations" model="ir.actions.act_window">
|
||||||
<field name="context">
|
<field name="context">
|
||||||
|
@ -50,9 +51,7 @@ For further information, please visit:
|
||||||
Known issues / Roadmap
|
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
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
@ -21,11 +21,8 @@ openerp.web_readonly_bypass = function(instance) {
|
||||||
* @param {Object} context->readonly_by_pass
|
* @param {Object} context->readonly_by_pass
|
||||||
*/
|
*/
|
||||||
ignore_readonly: function(data, options, mode, context){
|
ignore_readonly: function(data, options, mode, context){
|
||||||
console.log(options );
|
|
||||||
console.log(context );
|
|
||||||
var readonly_by_pass_fields = this.retrieve_readonly_by_pass_fields(
|
var readonly_by_pass_fields = this.retrieve_readonly_by_pass_fields(
|
||||||
options, context);
|
options, context);
|
||||||
console.log(readonly_by_pass_fields );
|
|
||||||
if(mode){
|
if(mode){
|
||||||
$.each( readonly_by_pass_fields, function( key, value ) {
|
$.each( readonly_by_pass_fields, function( key, value ) {
|
||||||
if(value==false){
|
if(value==false){
|
||||||
|
@ -34,7 +31,6 @@ openerp.web_readonly_bypass = function(instance) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
data = $.extend(data,readonly_by_pass_fields);
|
data = $.extend(data,readonly_by_pass_fields);
|
||||||
console.log(data );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +81,9 @@ openerp.web_readonly_bypass = function(instance) {
|
||||||
*/
|
*/
|
||||||
create : function(data, options) {
|
create : function(data, options) {
|
||||||
var self = this;
|
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);
|
return self._super(data,options);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -99,7 +97,9 @@ openerp.web_readonly_bypass = function(instance) {
|
||||||
*/
|
*/
|
||||||
write : function(id, data, options) {
|
write : function(id, data, options) {
|
||||||
var self = this;
|
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);
|
return self._super(id,data,options);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue