Browse Source

FIX

testing in all cases is better catch errno in JSON.parse.
attrs[action] is always “string” type.
pull/200/head
Cristian Salamea 10 years ago
parent
commit
c8887fd2f9
  1. 7
      web_action_conditionable/static/src/js/views.js

7
web_action_conditionable/static/src/js/views.js

@ -5,9 +5,10 @@ openerp.web_action_conditionable = function (instance) {
is_action_enabled: function(action) {
var attrs = this.fields_view.arch.attrs;
if (action in attrs) {
if ($.type(attrs[action]) == 'boolean') {
return JSON.parse(attrs[action])
} else {
try {
data = JSON.parse(attrs[action]);
return data;
} catch(error) {
var expr = attrs[action];
var expression = py.parse(py.tokenize(expr));
var cxt = this.dataset.get_context().__eval_context.__contexts[1];

Loading…
Cancel
Save