Friday, January 28, 2022
1 change · master
Resolved issues and error corrections
Odoo now blocks attempts to reuse an existing external identifier for a different type of record. This prevents updates from accidentally overwriting unrelated business or system records, improving data integrity during module updates or upgrades.
Original PR description
Before this commit, changing the model on an existing xml-id may lead to strange results. create any record in xml, ie: xml_id=my_xml_id, model=new_model => Odoo will create a new external_id, pointing to (new_model, id=1) change only the model in the xml, ie: xml_id=my_xml_id, model=ir.cron => Odoo will use the id of the existing external_id with the new model and points now to (ir.cron, id=1) AND REPLACE the ir.cron id=1 (autovacuum_job) with the data of the xml. This commit simply prevent that by raising when trying to recycle the same xmlid for another model. An explicit upgrade script to remove the existing xmlid and corresponding records should be write.