Skip to content
Snippets Groups Projects
Commit e85faf39 authored by Pierre Masereel's avatar Pierre Masereel Committed by Raphael Collet
Browse files

[IMP] base: add unique constraint on ir.property


There is no unique constraint on the properties to avoid having two
properties for the same field, company and res_id.

Having two properties for the same field, company and res_id, leads to
inconsistencies through the code, as reading a company-dependent field
nondeterministically returns one of the available property value.

So now, before creating a property, we have to check that there is not
already a value for the field, company and res_id and write or create
depending on if it is already exists.

The properties of specific records already satisfy the constraint thanks
to the implementation of company-dependent fields that use the method
`set_multi`.  We added a method `set_default` to set generic properties,
and its implementation does the right thing.  It also simplifies the
code to set such properties, by the way.

closes odoo/odoo#40473

Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
Co-authored-by: default avatarRaphael Collet <rco@odoo.com>
parent 8821f0e9
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment