Somebody write to me :
if you delete a record in a xml file and you update the module, the record will be deleted in database if you have not parameter noupdate="1" in <data>
I understand this. But I have a question.
- I create a record id=mycustom.stock_location_a in my custom module;
- I upgrade the module mycustom in my odoo;
- I check in Warehouse->Locations, the new record (stock_location_a) is there;
- The external ID (mycustom.stock_location_a) is of course created in ir.model.data.
- Now, I remove the record id=mycustom.stock_location_a in my XML.
- I upgrade mycustom again.
- Here, I suppose that Odoo will erase the record mycustom.stock_location_a
Here is my questions :
- But how Odoo can decide to delete the record? May be I have put the XML record in a other file or an other module, no????
- Will Odoo delete mycustom.stock_location_a?
- Which conditions before to delete it from Odoo?
if noupdate = 0 or not defined in <data>, when you update a module, odoo verify corresponding records between all records in xml files and records in table ir_model_data and in model defined for the record in xml, the relation between ir_model_data and the model are in ir_model_data with columns res_id (id in model table) model and module, complete_name is module_name.xml_id, you can see column noupdate too (file base/ir/ir_module.py).
For all new records add in xml file if noupdate=0, a record is add in ir_model_data and model, for existing records in ir_model_data and xml if noupdate=0, datas in model are updated, if noupdate=0and if a record is present in ir_model_data with values your module/your object/... but not in your module the record in ir_model_data and in the model defined in xml for the record will be deleted. But if there is a reference of your model record id in an other record you will have an integrity error.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 3/15/15, 8:29 AM|
|Seen: 1656 times|
|Last updated: 3/16/15, 8:10 AM|