c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #03842
[Bug 673696] Re: Server ORM bug V5. Error in read function with inherited field. Maybe V6 is also impacted
Let's me explain.
When we use product_variant_multi, we build various product from the
product template. As product.product inherit product_template the name
of the product is same as the product template.
The idea is to have field "name" (a function field) on product_product
which build a correct name with the product template name and the
product variants. (product name = product template name + product
variants)
I made a lots of test and there is nothing ambigous because is you want to read :
the product_template name you just have to do self.pool.get('product.template').read(....)
and the product_product name you just have to do self.pool.get('product.product').read(....).
Making this change on the orm will only impact people who are trying to
overwrite field on inherit object. For the moment there is only the
module product_variant_multi in development version.
I know that it's a little dangerous to create the field "name" in
product.product and the reason is because the code is not enough clean,
the proof I found this bug.
Please think twice before not fixing it, because without this we will
never have a powerfull ORM.
What do you think?
--
Server ORM bug V5. Error in read function with inherited field. Maybe V6 is also impacted
https://bugs.launchpad.net/bugs/673696
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
Status in OpenObject Server: Incomplete
Bug description:
We are working on product_variant_multi and so using inherited fields.
If you add the field "name" to the object product.product, the "read" function on the object product.product will give you the result of the field "name" of the object product.template.
If you look at orm.py, line 2333 :
You will see that the ORM doesn't make any check on the existing fields in product.product before reading them in product.template.
I just added a check
- cols = intersect(self._inherit_fields.keys(), fields_to_read)
+ cols = [x for x in intersect(self._inherit_fields.keys(), fields_to_read) if x not in self._columns.keys()]
For information : "cols" is the variable which contains the fields that we have to read in the inherited object.
With this patch fields are only read in the inherited object if they are not found in the actual object.
References