3
0
Fork 0

remove readonly managment initialization

7.0
Pierre Verkest 2015-10-03 01:24:15 +02:00
parent 858d554cfc
commit 0fb54c760f
1 changed files with 1 additions and 15 deletions

View File

@ -15,28 +15,14 @@ openerp.web_widget_boolean_switch = function(instance){
this.quick_edit = options.hasOwnProperty('quick_edit') ? this.quick_edit = options.hasOwnProperty('quick_edit') ?
options.quick_edit : false; options.quick_edit : false;
var readonly = options.hasOwnProperty('readonly') ?
options.readonly : false;
var switchOptions = options.hasOwnProperty('extra') ? var switchOptions = options.hasOwnProperty('extra') ?
options.extra : {}; options.extra : {};
// in case of domain (using attrs={...}), readonly is set afterward
if(!_.isBoolean(options.readonly)){
options.readonly = false;
}
_.extend(switchOptions, { _.extend(switchOptions, {
'readonly': options.hasOwnProperty('readonly') ?
options.readonly : readonly,
'disabled': options.hasOwnProperty('disabled') ? 'disabled': options.hasOwnProperty('disabled') ?
options.disabled : !this.quick_edit, options.disabled : !this.quick_edit,
}); });
//finnaly if readonly is false, we remove it to init widget
//with the value of its attributes well managed by qweb and
//FieldBooleanSwitch class
if(!switchOptions.readonly){
delete switchOptions.readonly;
}
if(options.hasOwnProperty('onSwitchChange')){ if(options.hasOwnProperty('onSwitchChange')){
switchOptions.onSwitchChange = options.onSwitchChange; switchOptions.onSwitchChange = options.onSwitchChange;
} }
@ -133,7 +119,7 @@ openerp.web_widget_boolean_switch = function(instance){
//Manage if it's grouped by boolean_switch widget field //Manage if it's grouped by boolean_switch widget field
var opt = {}; var opt = {};
_.extend(opt, options); _.extend(opt, options);
opt.readonly = true; opt.disabled = true;
checkboxes = view.$el.find( checkboxes = view.$el.find(
'th.oe_list_group_name input[type="checkbox"]'); 'th.oe_list_group_name input[type="checkbox"]');
new openerp.instances.instance0.web.BooleanSwitchWidget( new openerp.instances.instance0.web.BooleanSwitchWidget(