From 6c21cfb3239335081b0b56e7f736b71a6e3f2001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20L=C3=B3pez?= Date: Wed, 7 Dec 2016 19:58:25 +0000 Subject: [PATCH] [FIX] method-NAME: Fix case compute=None Fix OCA/pylint-odoo#88 --- pylint_odoo/checkers/no_modules.py | 3 ++- pylint_odoo/test_repo/broken_module/models/broken_model.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pylint_odoo/checkers/no_modules.py b/pylint_odoo/checkers/no_modules.py index ad133047..9bec2a69 100644 --- a/pylint_odoo/checkers/no_modules.py +++ b/pylint_odoo/checkers/no_modules.py @@ -318,7 +318,8 @@ def visit_call(self, node): argument_aux = argument.value if argument.arg in ['compute', 'search', 'inverse'] and \ isinstance(argument.value, astroid.Const) and \ - not argument.value.value.startswith( + argument_aux.value and \ + not argument_aux.value.startswith( '_' + argument.arg + '_'): self.add_message('method-' + argument.arg, node=argument_aux) diff --git a/pylint_odoo/test_repo/broken_module/models/broken_model.py b/pylint_odoo/test_repo/broken_module/models/broken_model.py index bf2c10ae..ea275855 100644 --- a/pylint_odoo/test_repo/broken_module/models/broken_model.py +++ b/pylint_odoo/test_repo/broken_module/models/broken_model.py @@ -39,6 +39,7 @@ class TestModel(models.Model): search='my_method_search', # bad search method name inverse='my_method_inverse', # bad inverse method name ) + compute_none = fields.Char(compute=None) other_field2 = fields.char( 'Other Field2',