Files
odoo_source/odoo/modules
Martin TrigauxandRaphael Collet 8f88570ca1 [FIX] base: proper removal of xmlid after update
Context:
After a module update, the records present in ir_model_data table but not in
self.pool.loaded_xmlids are considered as no longer needed and should be
removed.
An exception is done with noupdate=true entries.

Bug 1:
Entries with noupdate=NULL are not considered in the evaluation and are ignored
while it may be worth deleting.

Bug 2:
Some records with their external id being automatically created are not present
in self.pool.loaded_xmlids and may get removed after updating a module.

By a lucky coincidence, bug 1 make it so that records targeted by bug 2 are
ignored and not deleted (the "automagically" created ir.model.data often lack
a noupdate value).

Fix Bug 1:
Use a COALESCE to find both records with noupdate=NULL and noupdate=false

Fix Bug 2:
Depends on the source of the generated external id:

- ir.model:
The entries created through _reflect_model were not loaded in
self.loaded_xmlids
Use the proper ORM method _update_xmlids that correctly populates
self.pool.loaded_xmlids

- ir.model.category:
The categories were generated when the db was initalised, doing SQL was not
avoidable.
Create the categories in noupdate to avoid it being considered for removal.

- ir.property:
Are always created in noupdate in data files but in stock_account it was
manually created without being in noupdate

closes odoo/odoo#32881

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>


Co-authored-by: Raphael Collet <rco@odoo.com>
2019-06-11 12:04:08 +00:00
..