Skip to content

Commit

Permalink
[FIX] pylint_odoo: Fix IndexError corner case
Browse files Browse the repository at this point in the history
Running pylint for many files it raised an IndexError fixed here
  • Loading branch information
moylop260 committed Dec 19, 2024
1 parent fc3644f commit a90c713
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pylint_odoo/checkers/odoo_addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,10 @@ def get_odoo_models_class(self, node):
break
if not isinstance(attr, nodes.Name):
continue
imported_class = node.lookup(attr.name)[1][-1]
imported_class = node.lookup(attr.name)[1]
if not imported_class:
continue
imported_class = imported_class[-1]
package_names = []
if isinstance(imported_class, nodes.ImportFrom):
package_names = imported_class.modname.split(".")[:1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,3 +850,11 @@ class NoOdoo(object):
]
for query in queries:
self.env.cr.execute(query)

class Ccc(object):

class Ddd(object):
pass

class Eee(Ddd):
pass

0 comments on commit a90c713

Please sign in to comment.