OCA/pylint-odoo

Error in W8105 Check - Field Name Confused as a Field Attribute

Closed this issue · 1 comments

In the [W8105] attribute-deprecated verification, there's an error where the field name is mistakenly identified as a deprecated field attribute.

For example, in the following code:

class ExampleModel(models.Model):
    _name = "example.model"

    length = fields.Float()

The pre-commit check raises the following warning:

[W8105(attribute-deprecated), ExampleModel] attribute "length" deprecated

You mustn't use length as a field name, or there will be problems in JS due to the reserved word in that language.