From 88eb5581004b6170f12e677dab0e0a16c6c450dd Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Wed, 27 Feb 2019 16:35:49 +0100 Subject: [PATCH] [FIX][web_action_conditionable] lints --- .../static/src/js/views.js | 31 ++++++++++--------- .../tests/test_action_conditionable.py | 3 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/web_action_conditionable/static/src/js/views.js b/web_action_conditionable/static/src/js/views.js index a7764903..c80c3544 100644 --- a/web_action_conditionable/static/src/js/views.js +++ b/web_action_conditionable/static/src/js/views.js @@ -1,6 +1,7 @@ -/*global openerp, _, $ */ +/* global openerp, py, jQuery, _, _t, $ */ openerp.web_action_conditionable = function (instance) { + 'use strict'; instance.web.View.include({ /** * @override @@ -14,11 +15,11 @@ openerp.web_action_conditionable = function (instance) { var expr = attrs[action]; var expression = py.parse(py.tokenize(expr)); var cxt = new instance.web.CompoundContext( - this.get_fields_values && !_.isEmpty(this.fields) ? - // we're on a form that has loaded its fields - this.get_fields_values() : - // this always exists - this.dataset.get_context().get_eval_context() || + this.get_fields_values && !_.isEmpty(this.fields) + // We're on a form that has loaded its fields + ? this.get_fields_values() + // This always exists + : this.dataset.get_context().get_eval_context() || {} ).eval(); @@ -40,8 +41,8 @@ openerp.web_action_conditionable = function (instance) { } }, _is_action_enabled_eval_context: function(cxt) { - cxt['_group_refs'] = instance.session.group_refs; - cxt['_context'] = this.dataset.get_context().eval(); + cxt._group_refs = instance.session.group_refs; + cxt._context = this.dataset.get_context().eval(); }, }); @@ -54,7 +55,7 @@ openerp.web_action_conditionable = function (instance) { }, _load_record_web_action_conditionable: function() { var self = this; - // set correct classes + // Set correct classes this.$el.toggleClass( 'oe_cannot_create', !this.is_action_enabled('create') ); @@ -96,13 +97,13 @@ openerp.web_action_conditionable = function (instance) { this.guard_active(this.on_button_cancel) ); this.check_actual_mode(); - // update sidebar menu + // Update sidebar menu if (this.sidebar) { this.sidebar.items.other = _.filter( this.sidebar.items.other, function(item) { return ( - item.callback != self.on_button_delete && - item.callback != self.on_button_duplicate + item.callback !== self.on_button_delete && + item.callback !== self.on_button_duplicate ); } ); @@ -114,9 +115,9 @@ openerp.web_action_conditionable = function (instance) { self.is_action_enabled('create') && { label: _t('Duplicate'), callback: self.on_button_duplicate, - } + }, ])); } }, - }) -} + }); +}; diff --git a/web_action_conditionable/tests/test_action_conditionable.py b/web_action_conditionable/tests/test_action_conditionable.py index eec2b6ca..8c02552a 100644 --- a/web_action_conditionable/tests/test_action_conditionable.py +++ b/web_action_conditionable/tests/test_action_conditionable.py @@ -2,8 +2,7 @@ from mock import patch from openerp.tests.common import TransactionCase -from openerp.addons.web_action_conditionable.controllers.main \ - import MainController +from ..controllers.main import MainController class TestActionConditionable(TransactionCase):