Vauxoo / pylint-conf

Este proyecto se manejará el estándar de configuración de pylint versionado
GNU Lesser General Public License v3.0
0 stars 17 forks source link

False-positive E1133 (not-an-iterable) for iterable field #65

Closed luisg123v closed 3 years ago

luisg123v commented 3 years ago

A code like this:

for invoice in self.move_ids:

Which is perfectly valid, generates the following error:

Non-iterable value self.move_ids is used in an iterating context

It seems this lint isn't able to know that move_ids is an iterable, despite being an attribute (one2many field).

moylop260 commented 3 years ago

Could you share the pipeline URL where it is reproduced, please?

luisg123v commented 3 years ago

Here the pipeline.

CC @suniagajose

moylop260 commented 3 years ago

I can't reproduce it using the same branch.

In fact, the last pipeline the lint is green:

Check the pipeline of the MR:

If you can reproduce it again just re-open it, please

luisg123v commented 3 years ago

@moylop260 I was able to replicate it by:

At that point, it was replicated, but I created this MR with only the involved file.

Since I could replicate it, I'll reopen.

fernandahf commented 3 years ago

@luisg123v, @moylop260

According to research in same project that @luisg123v tested, the problem is that in same class where is checked lint, there is following onchange method that set move_ids to False (to clean it):

  @api.onchange("journal_id")
    def _onchange_journal_id(self):
        self.move_ids = False
        if not self.journal_id:
            self.currency_id = False
            self.move_ids = False
            return {}
        self.currency_id = self.journal_id.currency_id or self.company_id.currency_id

I had review and if I remove lines where move_ids is set, lint does not appear. I think that problem is how is clean move_ids and also correct way to clean it is:

self.move_ids = [(5, )]

I think that this issue must be closed because pylint is not the problem.

cc @suniagajose

Regards.

luisg123v commented 3 years ago

Thanks a lot @fernandahf.

I'll close this issue..