Browse Source
Merge pull request #861 from acsone/9.0-mig-web_action_conditionable_zak
[9.0][MIG]web_action_conditionable: migration to 9.0
pull/602/merge
Stéphane Bidoul (ACSONE)
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
54 additions and
44 deletions
-
setup/web_action_conditionable/odoo_addons/__init__.py
-
setup/web_action_conditionable/odoo_addons/web_action_conditionable
-
setup/web_action_conditionable/setup.py
-
web_action_conditionable/README.rst
-
web_action_conditionable/__init__.py
-
web_action_conditionable/__openerp__.py
-
web_action_conditionable/static/src/js/views.js
-
web_action_conditionable/views/view.xml
|
|
@ -0,0 +1 @@ |
|
|
|
__import__('pkg_resources').declare_namespace(__name__) |
|
|
@ -0,0 +1 @@ |
|
|
|
../../../web_action_conditionable |
|
|
@ -0,0 +1,6 @@ |
|
|
|
import setuptools |
|
|
|
|
|
|
|
setuptools.setup( |
|
|
|
setup_requires=['setuptools-odoo'], |
|
|
|
odoo_addon=True, |
|
|
|
) |
|
|
@ -34,13 +34,11 @@ 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/9.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 |
|
|
@ -49,10 +47,6 @@ For further information, please visit: |
|
|
|
|
|
|
|
* https://www.odoo.com/forum/help-1 |
|
|
|
|
|
|
|
Known issues / Roadmap |
|
|
|
====================== |
|
|
|
|
|
|
|
* ... |
|
|
|
|
|
|
|
Bug Tracker |
|
|
|
=========== |
|
|
|
|
|
@ -1 +0,0 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
@ -1,13 +1,14 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
|
{ |
|
|
|
"name": 'web_action_conditionable', |
|
|
|
"version": "8.0.0.1.0", |
|
|
|
"name": 'Web Action Conditionable', |
|
|
|
"version": "9.0.1.0.0", |
|
|
|
"depends": [ |
|
|
|
'base', |
|
|
|
'web', |
|
|
|
], |
|
|
|
'data': ['views/view.xml'], |
|
|
|
'data': [ |
|
|
|
'views/view.xml' |
|
|
|
], |
|
|
|
"author": "Cristian Salamea,Odoo Community Association (OCA)", |
|
|
|
'installable': False, |
|
|
|
"license": "AGPL-3", |
|
|
|
} |
|
|
@ -1,22 +1,27 @@ |
|
|
|
/*global openerp, _, $ */ |
|
|
|
/* Copyright 2018 Cristian Salamea |
|
|
|
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
|
|
|
|
|
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
odoo.define('web.web_action_conditionable', function (require) { |
|
|
|
"use strict"; |
|
|
|
|
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -1,10 +1,13 @@ |
|
|
|
<?xml version="1.0" encoding="utf-8"?> |
|
|
|
<openerp> |
|
|
|
<data> |
|
|
|
<template id="assets_backend" name="action conditionable assets" inherit_id="web.assets_backend"> |
|
|
|
<xpath expr="." position="inside"> |
|
|
|
<script type="text/javascript" src="/web_action_conditionable/static/src/js/views.js"></script> |
|
|
|
</xpath> |
|
|
|
</template> |
|
|
|
</data> |
|
|
|
</openerp> |
|
|
|
<!-- Copyright 2018 Cristian Salamea |
|
|
|
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> |
|
|
|
|
|
|
|
<odoo> |
|
|
|
|
|
|
|
<template id="assets_backend" name="action conditionable assets" inherit_id="web.assets_backend"> |
|
|
|
<xpath expr="." position="inside"> |
|
|
|
<script type="text/javascript" src="/web_action_conditionable/static/src/js/views.js"></script> |
|
|
|
</xpath> |
|
|
|
</template> |
|
|
|
|
|
|
|
</odoo> |