From 392f0ef14a93211781a5c6aa7ff96b0123d48bac Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Fri, 5 Jun 2015 07:53:38 +0200 Subject: [PATCH 01/10] [ADD] add module 'web_warning_on_save' --- web_warning_on_save/README.rst | 86 +++++++++++++++++++ web_warning_on_save/__init__.py | 22 +++++ web_warning_on_save/__openerp__.py | 40 +++++++++ web_warning_on_save/controller.py | 39 +++++++++ .../static/src/js/web_warning_on_save.js | 28 ++++++ 5 files changed, 215 insertions(+) create mode 100644 web_warning_on_save/README.rst create mode 100644 web_warning_on_save/__init__.py create mode 100644 web_warning_on_save/__openerp__.py create mode 100644 web_warning_on_save/controller.py create mode 100644 web_warning_on_save/static/src/js/web_warning_on_save.js diff --git a/web_warning_on_save/README.rst b/web_warning_on_save/README.rst new file mode 100644 index 00000000..60333530 --- /dev/null +++ b/web_warning_on_save/README.rst @@ -0,0 +1,86 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Module name +=========== + +This module was written to extend the functionality of saving a record in the web interface. +/!\/!\/!\ In no way this module stops the save of the record. You must consider this as a warning displayed +to the user AFTER save completed. /!\/!\/!\ + +Installation +============ + +To install this module, you need to: + +* install it + +Configuration +============= + +To configure this module, you need to: + +* nothing + +Usage +===== + +To use this module, you need to: + +* write a method called 'check_warning_on_save' which will make some checks and return a string + +example : + + def check_warning_on_save(self, cr, uid, id, context=None): + """ + @param: int: record_id + @return: string: message that should be displayed to the user + """ + res = "" + + record = self.browse(cr, uid, id, context=context) + # ... make some checks + + return res + +For further information, please visit: + +* https://www.odoo.com/forum/help-1 + +Known issues / Roadmap +====================== + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + + +Credits +======= + +Contributors +------------ + +* Damien Crier +* Vincent Renaville + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. + diff --git a/web_warning_on_save/__init__.py b/web_warning_on_save/__init__.py new file mode 100644 index 00000000..b3e0fb89 --- /dev/null +++ b/web_warning_on_save/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Damien Crier +# Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import controller \ No newline at end of file diff --git a/web_warning_on_save/__openerp__.py b/web_warning_on_save/__openerp__.py new file mode 100644 index 00000000..7fcedcd8 --- /dev/null +++ b/web_warning_on_save/__openerp__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Damien Crier +# Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + "name": "Web warning on save", + "version": "1.0", + "depends": ['web'], + "author": "Camptocamp,Odoo Community Association (OCA)", + 'license': 'AGPL-3', + 'website': 'http://www.camptocamp.com', + 'data': [ + ], + 'js': [ + 'static/src/js/web_warning_on_save.js', + ], + 'css': [ + ], + 'qweb': [ + ], + 'installable': True, + 'auto_install': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/web_warning_on_save/controller.py b/web_warning_on_save/controller.py new file mode 100644 index 00000000..fbd48584 --- /dev/null +++ b/web_warning_on_save/controller.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Damien Crier +# Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import openerp + + +class WarningOnSaveController(openerp.addons.web.http.Controller): + _cp_path = "/web/warning_on_save" + + @openerp.addons.web.http.jsonrequest + def check_warning_on_save(self, req, model, id): + """ + try to call a method on the model given in parameter + if method does not exist in the model, do nothing + """ + m = req.session.model(model) + try: + return getattr(m, 'check_warning_on_save')(id, req.context) + + except: + return False diff --git a/web_warning_on_save/static/src/js/web_warning_on_save.js b/web_warning_on_save/static/src/js/web_warning_on_save.js new file mode 100644 index 00000000..d299e2f4 --- /dev/null +++ b/web_warning_on_save/static/src/js/web_warning_on_save.js @@ -0,0 +1,28 @@ +openerp.web_warning_on_save = function (instance) { + + instance.web.FormView.include({ + on_button_save: function(e) { +// inherit method to be able to display an alert if +// method called returns a string + var id = 0; + var self = this; + self._super.apply(this, arguments).done(function(id){ + var model = self.model; + var param = {'model': model, + 'id': self.datarecord.id ? self.datarecord.id : id}; +// try { + self.rpc('/web/warning_on_save/check_warning_on_save', param) + .done(function(res) { + if (res != false){ + alert(res); + } + }); +// } +// catch(err){ +// // nothing +// } + }) + }, + }); + +}; From 7a48445c182cd3f230046ad3e2688cf3ae8a171a Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Fri, 5 Jun 2015 07:56:44 +0200 Subject: [PATCH 02/10] [FIX] pep8 [FIX] remove unuseful comments --- web_warning_on_save/__init__.py | 2 +- web_warning_on_save/static/src/js/web_warning_on_save.js | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/web_warning_on_save/__init__.py b/web_warning_on_save/__init__.py index b3e0fb89..4fe5a6e6 100644 --- a/web_warning_on_save/__init__.py +++ b/web_warning_on_save/__init__.py @@ -19,4 +19,4 @@ # ############################################################################## -import controller \ No newline at end of file +import controller diff --git a/web_warning_on_save/static/src/js/web_warning_on_save.js b/web_warning_on_save/static/src/js/web_warning_on_save.js index d299e2f4..acbd5e3b 100644 --- a/web_warning_on_save/static/src/js/web_warning_on_save.js +++ b/web_warning_on_save/static/src/js/web_warning_on_save.js @@ -10,17 +10,12 @@ openerp.web_warning_on_save = function (instance) { var model = self.model; var param = {'model': model, 'id': self.datarecord.id ? self.datarecord.id : id}; -// try { self.rpc('/web/warning_on_save/check_warning_on_save', param) .done(function(res) { if (res != false){ alert(res); } }); -// } -// catch(err){ -// // nothing -// } }) }, }); From a5dfee75b67e525c36a0d159e05ee869becc2d84 Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Mon, 8 Jun 2015 09:07:15 +0200 Subject: [PATCH 03/10] [FIX] fix according to review --- web_warning_on_save/README.rst | 20 ++----------------- web_warning_on_save/__init__.py | 2 +- web_warning_on_save/__openerp__.py | 31 +++++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/web_warning_on_save/README.rst b/web_warning_on_save/README.rst index 60333530..b35968aa 100644 --- a/web_warning_on_save/README.rst +++ b/web_warning_on_save/README.rst @@ -1,26 +1,13 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 -Module name +web_warning_on_save =========== This module was written to extend the functionality of saving a record in the web interface. /!\/!\/!\ In no way this module stops the save of the record. You must consider this as a warning displayed to the user AFTER save completed. /!\/!\/!\ - -Installation -============ - -To install this module, you need to: - -* install it - -Configuration -============= - -To configure this module, you need to: - -* nothing +If you don't want OpenERP to save the record, you should use constraints. Usage ===== @@ -47,9 +34,6 @@ For further information, please visit: * https://www.odoo.com/forum/help-1 -Known issues / Roadmap -====================== - Bug Tracker =========== diff --git a/web_warning_on_save/__init__.py b/web_warning_on_save/__init__.py index 4fe5a6e6..7c5f67fb 100644 --- a/web_warning_on_save/__init__.py +++ b/web_warning_on_save/__init__.py @@ -19,4 +19,4 @@ # ############################################################################## -import controller +from . import controller diff --git a/web_warning_on_save/__openerp__.py b/web_warning_on_save/__openerp__.py index 7fcedcd8..60e538d3 100644 --- a/web_warning_on_save/__openerp__.py +++ b/web_warning_on_save/__openerp__.py @@ -25,6 +25,36 @@ "author": "Camptocamp,Odoo Community Association (OCA)", 'license': 'AGPL-3', 'website': 'http://www.camptocamp.com', + 'description': """ + This module was written to extend the functionality of + saving a record in the web interface. + /!\/!\/!\ In no way this module stops the save of the record. + You must consider this as a warning displayed + to the user AFTER save completed. /!\/!\/!\ + If you don't want OpenERP to save the record, you should use constraints. + + Usage + ===== + + To use this module, you need to: + + * write a method called 'check_warning_on_save' which will make some checks + and return a string + + example : + + def check_warning_on_save(self, cr, uid, id, context=None): + ''' + @param: int: record_id + @return: string: message that should be displayed to the user + ''' + res = "" + + record = self.browse(cr, uid, id, context=context) + # ... make some checks + + return res + """, 'data': [ ], 'js': [ @@ -37,4 +67,3 @@ 'installable': True, 'auto_install': False, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 239cc13fffd369ffa7aa081549100345fda9ffbf Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Mon, 8 Jun 2015 10:58:59 +0200 Subject: [PATCH 04/10] [FIX] rename controller [IMP] launch openerp.web.Dialog instead of an alert() --- web_warning_on_save/README.rst | 4 +- web_warning_on_save/controller.py | 6 +-- .../static/src/js/web_warning_on_save.js | 39 +++++++++++-------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/web_warning_on_save/README.rst b/web_warning_on_save/README.rst index b35968aa..611f2756 100644 --- a/web_warning_on_save/README.rst +++ b/web_warning_on_save/README.rst @@ -1,8 +1,8 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 -web_warning_on_save -=========== +Raise warning when saving +========================= This module was written to extend the functionality of saving a record in the web interface. /!\/!\/!\ In no way this module stops the save of the record. You must consider this as a warning displayed diff --git a/web_warning_on_save/controller.py b/web_warning_on_save/controller.py index fbd48584..9680e33d 100644 --- a/web_warning_on_save/controller.py +++ b/web_warning_on_save/controller.py @@ -23,7 +23,7 @@ import openerp class WarningOnSaveController(openerp.addons.web.http.Controller): - _cp_path = "/web/warning_on_save" + _cp_path = "/web_warning_on_save" @openerp.addons.web.http.jsonrequest def check_warning_on_save(self, req, model, id): @@ -32,8 +32,8 @@ class WarningOnSaveController(openerp.addons.web.http.Controller): if method does not exist in the model, do nothing """ m = req.session.model(model) - try: + if hasattr(m, 'check_warning_on_save'): return getattr(m, 'check_warning_on_save')(id, req.context) - except: + else: return False diff --git a/web_warning_on_save/static/src/js/web_warning_on_save.js b/web_warning_on_save/static/src/js/web_warning_on_save.js index acbd5e3b..7f91baf6 100644 --- a/web_warning_on_save/static/src/js/web_warning_on_save.js +++ b/web_warning_on_save/static/src/js/web_warning_on_save.js @@ -1,23 +1,28 @@ openerp.web_warning_on_save = function (instance) { - instance.web.FormView.include({ - on_button_save: function(e) { + instance.web.FormView.include({ + on_button_save: function(e) { // inherit method to be able to display an alert if // method called returns a string - var id = 0; - var self = this; - self._super.apply(this, arguments).done(function(id){ - var model = self.model; - var param = {'model': model, - 'id': self.datarecord.id ? self.datarecord.id : id}; - self.rpc('/web/warning_on_save/check_warning_on_save', param) - .done(function(res) { - if (res != false){ - alert(res); - } - }); - }) - }, - }); + var self = this; + return self._super.apply(this, arguments).done(function(id){ + var model = self.model; + var param = { + 'model': model, + 'id': self.datarecord.id ? self.datarecord.id : id + }; + self.rpc('/web_warning_on_save/check_warning_on_save', param) + .done(function(res) { + if (res != false){ + var dialog = new instance.web.Dialog(this, { + title: _t("Warning"), + width: 850, + }).open(); + dialog.$el.html(res); + } + }); + }) + }, + }); }; From 230ed748d4bbce84ab3506a3b019c56b1ca28efd Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Mon, 8 Jun 2015 11:06:39 +0200 Subject: [PATCH 05/10] [ADD] add translation template file --- .../i18n/web_warning_on_save.pot | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 web_warning_on_save/i18n/web_warning_on_save.pot diff --git a/web_warning_on_save/i18n/web_warning_on_save.pot b/web_warning_on_save/i18n/web_warning_on_save.pot new file mode 100644 index 00000000..48747415 --- /dev/null +++ b/web_warning_on_save/i18n/web_warning_on_save.pot @@ -0,0 +1,31 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * web_warning_on_save +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-06-08 09:04+0000\n" +"PO-Revision-Date: 2015-06-08 09:04+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_warning_on_save +#: code:_description:0 +#: model:ir.model,name:web_warning_on_save.model_res_users +#, python-format +msgid "Users" +msgstr "" + +#. module: web_warning_on_save +#. openerp-web +#: code:addons/web_warning_on_save/static/src/js/web_warning_on_save.js:18 +#, python-format +msgid "Warning" +msgstr "" + From 44aae79bac0fd3b4415c373f577cee2e14364d22 Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Mon, 8 Jun 2015 17:02:38 +0200 Subject: [PATCH 06/10] [FIX] hasattr in controllers returns always 'True' so check error if AttributeError is raised and catch it --- web_warning_on_save/controller.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/web_warning_on_save/controller.py b/web_warning_on_save/controller.py index 9680e33d..12ad2fad 100644 --- a/web_warning_on_save/controller.py +++ b/web_warning_on_save/controller.py @@ -19,9 +19,12 @@ # ############################################################################## +import xmlrpclib + import openerp + class WarningOnSaveController(openerp.addons.web.http.Controller): _cp_path = "/web_warning_on_save" @@ -32,8 +35,12 @@ class WarningOnSaveController(openerp.addons.web.http.Controller): if method does not exist in the model, do nothing """ m = req.session.model(model) - if hasattr(m, 'check_warning_on_save'): + try: return getattr(m, 'check_warning_on_save')(id, req.context) - else: - return False + except xmlrpclib.Fault as e: + if 'AttributeError' in e.faultString: + return False + else: + raise openerp.osv.osv.except_osv('Error', e.faultCode) + From 368e2149274df6f2c44f6ac8004977fa39d52153 Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Mon, 29 Jun 2015 10:01:06 +0200 Subject: [PATCH 07/10] [FIX] flake8 and RST corrections according to code review --- web_warning_on_save/README.rst | 22 +++++++++++++++------- web_warning_on_save/controller.py | 5 +---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/web_warning_on_save/README.rst b/web_warning_on_save/README.rst index 611f2756..ce3a7837 100644 --- a/web_warning_on_save/README.rst +++ b/web_warning_on_save/README.rst @@ -5,8 +5,14 @@ Raise warning when saving ========================= This module was written to extend the functionality of saving a record in the web interface. -/!\/!\/!\ In no way this module stops the save of the record. You must consider this as a warning displayed -to the user AFTER save completed. /!\/!\/!\ + +/!\\/!\\/!\\ + +In no way this module stops the save of the record. You must consider this as a warning displayed +to the user AFTER save completed. + +/!\\/!\\/!\\ + If you don't want OpenERP to save the record, you should use constraints. Usage @@ -18,16 +24,18 @@ To use this module, you need to: example : - def check_warning_on_save(self, cr, uid, id, context=None): +.. code:: python + + def check_warning_on_save(self, cr, uid, id, context=None): """ @param: int: record_id @return: string: message that should be displayed to the user """ res = "" - + record = self.browse(cr, uid, id, context=context) - # ... make some checks - + # ... make some checks + return res For further information, please visit: @@ -41,7 +49,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. +`here `_. Credits diff --git a/web_warning_on_save/controller.py b/web_warning_on_save/controller.py index 12ad2fad..58342a43 100644 --- a/web_warning_on_save/controller.py +++ b/web_warning_on_save/controller.py @@ -20,11 +20,9 @@ ############################################################################## import xmlrpclib - import openerp - class WarningOnSaveController(openerp.addons.web.http.Controller): _cp_path = "/web_warning_on_save" @@ -42,5 +40,4 @@ class WarningOnSaveController(openerp.addons.web.http.Controller): if 'AttributeError' in e.faultString: return False else: - raise openerp.osv.osv.except_osv('Error', e.faultCode) - + raise openerp.osv.osv.except_osv('Error', e.faultCode) From f4d7f21c046ccbafd568c0138af0401ca57ef671 Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Tue, 7 Jul 2015 10:42:59 +0200 Subject: [PATCH 08/10] [IMP] move controller.py in controllers' folder --- web_warning_on_save/__init__.py | 2 +- web_warning_on_save/controllers/__init__.py | 22 +++++++++++++++++++ .../{ => controllers}/controller.py | 0 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 web_warning_on_save/controllers/__init__.py rename web_warning_on_save/{ => controllers}/controller.py (100%) diff --git a/web_warning_on_save/__init__.py b/web_warning_on_save/__init__.py index 7c5f67fb..7f72dfd5 100644 --- a/web_warning_on_save/__init__.py +++ b/web_warning_on_save/__init__.py @@ -19,4 +19,4 @@ # ############################################################################## -from . import controller +from . import controllers diff --git a/web_warning_on_save/controllers/__init__.py b/web_warning_on_save/controllers/__init__.py new file mode 100644 index 00000000..7c5f67fb --- /dev/null +++ b/web_warning_on_save/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Damien Crier +# Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import controller diff --git a/web_warning_on_save/controller.py b/web_warning_on_save/controllers/controller.py similarity index 100% rename from web_warning_on_save/controller.py rename to web_warning_on_save/controllers/controller.py From bf8d74f8bd00217770c4b0bb0f88f0b0d428fb58 Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Fri, 4 Sep 2015 10:06:56 +0200 Subject: [PATCH 09/10] [FIX] add default method (return False) in BaseModel --- web_warning_on_save/__init__.py | 1 + web_warning_on_save/orm.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 web_warning_on_save/orm.py diff --git a/web_warning_on_save/__init__.py b/web_warning_on_save/__init__.py index 7f72dfd5..dde4f90b 100644 --- a/web_warning_on_save/__init__.py +++ b/web_warning_on_save/__init__.py @@ -20,3 +20,4 @@ ############################################################################## from . import controllers +from . import orm diff --git a/web_warning_on_save/orm.py b/web_warning_on_save/orm.py new file mode 100644 index 00000000..cbaf029a --- /dev/null +++ b/web_warning_on_save/orm.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Damien Crier +# Copyright 2015 Camptocamp SA +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import orm + + +def check_warning_on_save(self, cr, uid, id, context=None): + return False + +orm.BaseModel.check_warning_on_save = check_warning_on_save From d7356567e9f64804be51c0c3b1192d0a86c1df4e Mon Sep 17 00:00:00 2001 From: Damien Crier Date: Fri, 4 Sep 2015 10:24:40 +0200 Subject: [PATCH 10/10] [IMP] replace 'getattr' call by real call method --- web_warning_on_save/controllers/controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_warning_on_save/controllers/controller.py b/web_warning_on_save/controllers/controller.py index 58342a43..67336390 100644 --- a/web_warning_on_save/controllers/controller.py +++ b/web_warning_on_save/controllers/controller.py @@ -34,7 +34,7 @@ class WarningOnSaveController(openerp.addons.web.http.Controller): """ m = req.session.model(model) try: - return getattr(m, 'check_warning_on_save')(id, req.context) + return m.check_warning_on_save(id, req.context) except xmlrpclib.Fault as e: if 'AttributeError' in e.faultString: