[IMP] : black, isort, prettier

pull/2141/head
ahenriquez 2020-04-27 18:47:21 +02:00 committed by Jasmin Solanki
parent de855a52a7
commit 1b6868cb95
3 changed files with 21 additions and 17 deletions

View File

@ -1,14 +1,11 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
"name": 'web_action_conditionable', "name": "web_action_conditionable",
"version": "12.0.1.0.0", "version": "12.0.1.0.0",
"depends": [ "depends": ["base", "web",],
'base', "data": ["views/view.xml"],
'web',
],
'data': ['views/view.xml'],
"author": "Cristian Salamea,Odoo Community Association (OCA)", "author": "Cristian Salamea,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web", "website": "https://github.com/OCA/web",
"license": "AGPL-3", "license": "AGPL-3",
'installable': True, "installable": True,
} }

View File

@ -1,28 +1,28 @@
/* global py */ /* global py */
/* Copyright 2019 Alexandre Díaz /* Copyright 2019 Alexandre Díaz
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define('web.web_action_conditionable', function (require) { odoo.define("web.web_action_conditionable", function(require) {
"use strict"; "use strict";
var FieldOne2Many = require('web.relational_fields').FieldOne2Many; var FieldOne2Many = require("web.relational_fields").FieldOne2Many;
FieldOne2Many.include({ FieldOne2Many.include({
init: function () { init: function() {
var self = this; var self = this;
try { try {
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
} catch (error) { } catch (error) {
var arch = this.view && this.view.arch; var arch = this.view && this.view.arch;
if (arch) { if (arch) {
['create', 'delete'].forEach(function (item) { ["create", "delete"].forEach(function(item) {
if (!_.has(arch.attrs, item)) { if (!_.has(arch.attrs, item)) {
return; return;
} }
var expr = arch.attrs[item]; var expr = arch.attrs[item];
try { try {
self.activeActions[item] = py.evaluate( self.activeActions[item] = py
py.parse(py.tokenize(expr)), .evaluate(py.parse(py.tokenize(expr)), self.recordData)
self.recordData).toJSON(); .toJSON();
} catch (ignored) { } catch (ignored) {
// Do nothing // Do nothing
} }

View File

@ -1,8 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <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/field_one2many.js"></script> <script
type="text/javascript"
src="/web_action_conditionable/static/src/js/field_one2many.js"
/>
</xpath> </xpath>
</template> </template>
</odoo> </odoo>