Browse Source

py.eval is not protect against undefined

pull/236/head
Pierre Verkest 9 years ago
parent
commit
e402b8a73f
  1. 4
      web_widget_boolean_switch/static/src/js/web_widget_boolean_switch.js

4
web_widget_boolean_switch/static/src/js/web_widget_boolean_switch.js

@ -113,7 +113,7 @@ openerp.web_widget_boolean_switch = function(instance){
switch_fields.forEach(function(field){
var checkboxes;
var options = py.eval(field.options);
var options = field.options ? py.eval(field.options) : {};
if(view.grouped){
//Manage if it's grouped by boolean_switch widget field
@ -134,7 +134,7 @@ openerp.web_widget_boolean_switch = function(instance){
var id = $(event.target).data('rowid');
var values = {};
values[this.field.name] = state;
var context = py.eval(field.context);
var context = field.context ? py.eval(field.context) : {};
_.extend(context, view.session.user_context);
var model = new openerp.instances.instance0.web.Model(this.view.model);
model.call('write', [[id], values],

Loading…
Cancel
Save