OCA / pylint-odoo

Odoo plugin for Pylint
http://www.pylint.org
142 stars 168 forks source link

seemingly wrongly reported missing override of abstract method #483

Closed Timizzda closed 8 months ago

Timizzda commented 8 months ago

While upgrading our module to odoo 17.0 pylint complained about an abstract method not being overriden in a child class.

In Odoo 17 the implementation of onchange has been moved from odoo/odoo/models.py to the web module (https://github.com/odoo/odoo/blame/17.0/odoo/models.py#L6900). Pylint seems to not be able to figure out that it's implemented there so it throws an error.

Running pylint on odoo/addons/mail/models/mail_activity.py results in the following warning

odoo/addons/mail/models/mail_activity.py:19:0: W0223: Method 'onchange' is abstract in class 'BaseModel' but is not overridden in child class 'MailActivity' (abstract-method)

To Reproduce

Affected versions: 9.0.5, 9.0.4 and probably more

Steps to reproduce the behavior:

  1. Install pylint-odoo
  2. run it on any python file that defines/inherits a model in Odoo 17, for example odoo/addons/mail/models/mail_activity.py

I'm not entirely sure if this is an issue that can be solved in pylint-odoo though...

moylop260 commented 8 months ago

It is not related with this plugin pylint-odoo since

1) It is not a custom check for this plugin but pylint project

You can see the checks created for this plugin from the readme file: https://github.com/OCA/pylint-odoo/blob/main/README.md

2) it is not a check that you should enable for odoo projects

Check the following templates of configuration files from OCA project https://github.com/OCA/oca-addons-repo-template/tree/master/src

or custom one for our company https://github.com/Vauxoo/pre-commit-vauxoo/tree/main/src/pre_commit_vauxoo/cfg

Both projects don't have enabled this check