From 2cc3ba4bff97940d64d69b6efb7fb2a94ac78942 Mon Sep 17 00:00:00 2001 From: Cristian Salamea Date: Sun, 7 Oct 2018 10:25:04 -0500 Subject: [PATCH] [10.0] migrated to new API module web_action_conditionable (#547) * [IMP] migrated to new API * Update view.xml --- web_action_conditionable/__manifest__.py | 5 +-- .../static/src/js/views.js | 45 ++++++++++--------- web_action_conditionable/views/view.xml | 12 ++--- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/web_action_conditionable/__manifest__.py b/web_action_conditionable/__manifest__.py index e5049104..f8001d6c 100644 --- a/web_action_conditionable/__manifest__.py +++ b/web_action_conditionable/__manifest__.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- { "name": 'web_action_conditionable', - "version": "10.0.1.0.0", + "version": "10.0.0.1.0", "depends": [ - 'base', - 'web', + 'web' ], 'data': ['views/view.xml'], "author": "Cristian Salamea,Odoo Community Association (OCA)", diff --git a/web_action_conditionable/static/src/js/views.js b/web_action_conditionable/static/src/js/views.js index af0a3494..2733c353 100644 --- a/web_action_conditionable/static/src/js/views.js +++ b/web_action_conditionable/static/src/js/views.js @@ -1,24 +1,27 @@ -odoo.define('web.web_action_conditionable', function (require) { - "use strict"; +/*global openerp, _, $ */ +odoo.define('web_action_conditionable', function(require){ + "use strict"; - var View = require('web.View'); + 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; - } - } - }); + 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; + } + } + + }); }); diff --git a/web_action_conditionable/views/view.xml b/web_action_conditionable/views/view.xml index 494c2fe6..f4d9bd8f 100644 --- a/web_action_conditionable/views/view.xml +++ b/web_action_conditionable/views/view.xml @@ -1,8 +1,10 @@ - + + +