diff options
| author | Pierre Masereel <pim@odoo.com> | 2019-11-15 15:38:48 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2019-11-22 12:34:43 +0000 |
| commit | e85faf398659a5beb0b1570a06af64dcf78dc1c8 (patch) | |
| tree | 2726de4e47cb5f61bfd748416f85f3fadfb6bf7d /addons/website_forum/data | |
| parent | 8821f0e9176e3b976828f088ce5b7f5c6517b0c7 (diff) | |
[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: Xavier Morel (xmo) <xmo@odoo.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
Diffstat (limited to 'addons/website_forum/data')
0 files changed, 0 insertions, 0 deletions
