3
0
Fork 0

Merge pull request #861 from acsone/9.0-mig-web_action_conditionable_zak

[9.0][MIG]web_action_conditionable: migration to 9.0
9.0
Stéphane Bidoul (ACSONE) 2018-07-20 18:50:15 +02:00 committed by GitHub
commit eda6b8e650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 54 additions and 44 deletions

View File

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@ -0,0 +1 @@
../../../web_action_conditionable

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@ -34,13 +34,11 @@ Not needed.
Usage Usage
===== =====
To use this module, you need to: This module has no direct interface, it only adds functionality for custom views.
* go to ...
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :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 .. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example .. branch is "8.0" for example
@ -49,10 +47,6 @@ For further information, please visit:
* https://www.odoo.com/forum/help-1 * https://www.odoo.com/forum/help-1
Known issues / Roadmap
======================
* ...
Bug Tracker Bug Tracker
=========== ===========

View File

@ -1 +0,0 @@
# -*- coding: utf-8 -*-

View File

@ -1,13 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
{ {
"name": 'web_action_conditionable', "name": 'Web Action Conditionable',
"version": "8.0.0.1.0", "version": "9.0.1.0.0",
"depends": [ "depends": [
'base',
'web', 'web',
], ],
'data': ['views/view.xml'], 'data': [
'views/view.xml'
],
"author": "Cristian Salamea,Odoo Community Association (OCA)", "author": "Cristian Salamea,Odoo Community Association (OCA)",
'installable': False, "license": "AGPL-3",
} }

View File

@ -1,7 +1,12 @@
/*global openerp, _, $ */ /* Copyright 2018 Cristian Salamea
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
openerp.web_action_conditionable = function (instance) { odoo.define('web.web_action_conditionable', function (require) {
instance.web.View.include({ "use strict";
var View = require('web.View');
View.include({
is_action_enabled: function(action) { is_action_enabled: function(action) {
var attrs = this.fields_view.arch.attrs; var attrs = this.fields_view.arch.attrs;
if (action in attrs) { if (action in attrs) {
@ -12,11 +17,11 @@ openerp.web_action_conditionable = function (instance) {
var expression = py.parse(py.tokenize(expr)); var expression = py.parse(py.tokenize(expr));
var cxt = this.dataset.get_context().__eval_context.__contexts[1]; var cxt = this.dataset.get_context().__eval_context.__contexts[1];
var result = py.evaluate(expression, cxt).toJSON(); var result = py.evaluate(expression, cxt).toJSON();
return result return result;
} }
} else { } else {
return true; return true;
} }
} }
}); });
} });

View File

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <!-- Copyright 2018 Cristian Salamea
<data> 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"> <template id="assets_backend" name="action conditionable assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<script type="text/javascript" src="/web_action_conditionable/static/src/js/views.js"></script> <script type="text/javascript" src="/web_action_conditionable/static/src/js/views.js"></script>
</xpath> </xpath>
</template> </template>
</data>
</openerp> </odoo>