mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_action_conditionable: Migration to 11.0
This commit is contained in:
committed by
Jairo Llopis
parent
a3a57b0d02
commit
f0e506345f
@@ -1,22 +1,24 @@
|
||||
/*global openerp, _, $ */
|
||||
odoo.define('web.web_action_conditionable', function (require) {
|
||||
"use strict";
|
||||
|
||||
openerp.web_action_conditionable = function (instance) {
|
||||
instance.web.View.include({
|
||||
is_action_enabled: function(action) {
|
||||
var attrs = this.fields_view.arch.attrs;
|
||||
if (action in attrs) {
|
||||
try {
|
||||
return this._super(action);
|
||||
} catch(error) {
|
||||
var expr = attrs[action];
|
||||
var expression = py.parse(py.tokenize(expr));
|
||||
var cxt = this.dataset.get_context().__eval_context.__contexts[1];
|
||||
var result = py.evaluate(expression, cxt).toJSON();
|
||||
return result
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
var View = require('web.View');
|
||||
|
||||
View.include({
|
||||
is_action_enabled: function(action) {
|
||||
var attrs = this.fields_view.arch.attrs;
|
||||
if (action in attrs) {
|
||||
try {
|
||||
return this._super(action);
|
||||
} catch(error) {
|
||||
var expr = attrs[action];
|
||||
var expression = py.parse(py.tokenize(expr));
|
||||
var cxt = this.dataset.get_context().__eval_context.__contexts[1];
|
||||
var result = py.evaluate(expression, cxt).toJSON();
|
||||
return result
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user