diff --git a/setup/web_action_conditionable/odoo/__init__.py b/setup/web_action_conditionable/odoo/__init__.py new file mode 100644 index 00000000..de40ea7c --- /dev/null +++ b/setup/web_action_conditionable/odoo/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/web_action_conditionable/odoo/addons/__init__.py b/setup/web_action_conditionable/odoo/addons/__init__.py new file mode 100644 index 00000000..de40ea7c --- /dev/null +++ b/setup/web_action_conditionable/odoo/addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/web_action_conditionable/odoo/addons/web_action_conditionable b/setup/web_action_conditionable/odoo/addons/web_action_conditionable new file mode 120000 index 00000000..048ff8cb --- /dev/null +++ b/setup/web_action_conditionable/odoo/addons/web_action_conditionable @@ -0,0 +1 @@ +../../../../web_action_conditionable \ No newline at end of file diff --git a/setup/web_action_conditionable/setup.py b/setup/web_action_conditionable/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/web_action_conditionable/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_action_conditionable/README.rst b/web_action_conditionable/README.rst index 4ed2152b..e29871cd 100644 --- a/web_action_conditionable/README.rst +++ b/web_action_conditionable/README.rst @@ -1,6 +1,8 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 +======================== Web Action Conditionable ======================== @@ -34,42 +36,38 @@ Not needed. Usage ===== -To use this module, you need to: - -* go to ... +This module has no direct interface, it only adds functionality for custom views. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/web/8.0 + :target: https://runbot.odoo-community.org/runbot/162/10.0 .. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt .. branch is "8.0" for example -For further information, please visit: - -* https://www.odoo.com/forum/help-1 - -Known issues / Roadmap -====================== - -* ... - Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. - +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. Credits ======= +Images +------ + +* Odoo Community Association: `Icon `_. + Contributors ------------ * Cristian Salamea +* André Paramés (https://www.acsone.eu/) + +Do not contact contributors directly about support or help with technical issues. Maintainer ---------- @@ -84,4 +82,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit http://odoo-community.org. +To contribute to this module, please visit https://odoo-community.org. diff --git a/web_action_conditionable/__init__.py b/web_action_conditionable/__init__.py index 40a96afc..e69de29b 100644 --- a/web_action_conditionable/__init__.py +++ b/web_action_conditionable/__init__.py @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/web_action_conditionable/__manifest__.py b/web_action_conditionable/__manifest__.py index 4741f8b5..296d4774 100644 --- a/web_action_conditionable/__manifest__.py +++ b/web_action_conditionable/__manifest__.py @@ -1,13 +1,12 @@ -# -*- coding: utf-8 -*- - { "name": 'web_action_conditionable', - "version": "8.0.0.1.0", + "version": "10.0.1.0.0", "depends": [ 'base', 'web', ], 'data': ['views/view.xml'], "author": "Cristian Salamea,Odoo Community Association (OCA)", - 'installable': False, + "license": "AGPL-3", + 'installable': True, } diff --git a/web_action_conditionable/static/src/js/views.js b/web_action_conditionable/static/src/js/views.js index 5eeb6c4a..af0a3494 100644 --- a/web_action_conditionable/static/src/js/views.js +++ b/web_action_conditionable/static/src/js/views.js @@ -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; + } + } + }); +}); diff --git a/web_action_conditionable/views/view.xml b/web_action_conditionable/views/view.xml index c1de0b32..494c2fe6 100644 --- a/web_action_conditionable/views/view.xml +++ b/web_action_conditionable/views/view.xml @@ -1,10 +1,8 @@ - - - - - + + +