Skip to content

Commit

Permalink
[FIX] Checking better the field_name OCA#109
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusZapata committed Jan 30, 2017
1 parent 4fa6c37 commit ed364b0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pylint_odoo/checkers/no_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,14 @@ def visit_call(self, node):
for argument in args:
argument_aux = argument
# Check this 'name = fields.Char("name")'
field_name = (argument.parent.parent.targets[0].name
.replace('_', ' '))
field_name = ''
if (argument.parent and argument.parent.parent and
hasattr(argument.parent.parent, 'targets') and
argument.parent.parent.targets and
hasattr(argument.parent.parent.targets[0],
'name')):
field_name = (argument.parent.parent.targets[0].name
.replace('_', ' '))
if (isinstance(argument, astroid.Const) and
(index ==
FIELDS_METHOD.get(argument.parent.func.attrname, 0)) and
Expand Down

0 comments on commit ed364b0

Please sign in to comment.