콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
10010 화면

Hello gang,

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.

Example :

  • 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?
아바타
취소
베스트 답변

Hi,

           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.

bye

아바타
취소
작성자

thanks a lot. I will analyze each word of your answer.

관련 게시물 답글 화면 활동
3
7월 24
2655
0
4월 17
5247
3
5월 16
7963
1
2월 24
2767
5
2월 23
29587