mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[10.0] migrated to new API module web_action_conditionable (#547)
* [IMP] migrated to new API * Update view.xml
This commit is contained in:
committed by
Moises Lopez - https://www.vauxoo.com/
parent
493a9dd67b
commit
2cc3ba4bff
@@ -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)",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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>
|
||||
<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>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user