Vauxoo / pylint-odoo

1 stars 4 forks source link

[ADD] missing-depend: Use of xml_id without depends #29

Closed moylop260 closed 8 years ago

moylop260 commented 8 years ago

A module_child.xml_id was used in module_parent where the depends tree don't exists module_child

We have the following issue and this one

We need a new check to detect early this common issue. However, for this check we will need a full git clone of oca_dependencies.txt to get all recursive depends...

Then CI build of LINT=1 don't have all recursive depends. The CI build of TESTS=1 have all recursive depends but don't run lint checks.

Then we will need a way to run just this lint check for TESTS=1 environment...

FYI

LuisAlejandro commented 8 years ago

Cool, working on it ASAP.

LuisAlejandro commented 8 years ago

What we can do is to check if an xml_id like the one on vauxoo/yoytec#1163 does have its dependency listed in the manifest file. As simple as:

report.xml

<report id="[MODULE].[ID]"

Is [MODULE] listed in manifest file? No > FAIL YES > PASS

But in that case we don't need to clone the oca dependencies, or do we?

I don't know if i understood the problem correctly. If the problem is that a module referenced by a report is not listed in the manifest, then the check is very simple.

If the problem is that the ID of a module no longer exists, then another check should be made:

report.xml

<report id="[MODULE].[ID]"

Does [MODULE] has [ID]? No > FAIL YES > PASS

And, furthermore, one should be able to specify a version for the depends in the manifest file. So that if an [ID] disappears or changes name in a version, then one can say "this depends on version NN that has [ID]". I think this also leads to the discussion on OCA, IMHO, odoo modules should be python packages.

moylop260 commented 8 years ago

Consider the following:

The module_c create the xml_id: module_c.xml_id_01 The module_a use a reference to module_c.xml_id_01 then works! Fail: No, Pass: Yes Because the full depends tree have access to module_c from module_a

moylop260 commented 8 years ago

@LuisAlejandro I'll take this issue

moylop260 commented 8 years ago

Fixed from https://github.com/Vauxoo/server-tools/pull/41/files