Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5496 มุมมอง

Hi guys,

I have a module containing 2 models (A and B). For model A, I have a xml data file that need to be import before Odoo can do any modification I made in model B. How can I make this happen without splitting the 2 model into 2 modules ? 

Update: What I meant is that the xml file to use to load data into model A and model will work on that data. And the two action mentioned happen within the same update for the module that contains A and B.

อวตาร
ละทิ้ง

In the end how did you resolved this ?

I have a similar situation (detailed in the link below) and I don't find any working solution for setting default value for model B field based on model A XML data (which isn't loaded yet)

I know that data files in the manifest are loaded in order, but there I have only data for model A which is needed in model B default value in a Many2one field)

https://www.odoo.com/forum/help-1/add-required-many2one-field-pointing-to-new-model-defined-in-the-same-module-184290

คำตอบที่ดีที่สุด

Odoo will load data file as a defined sequence on the manifest file.

__menifest__.py

......

 'data': [

   '/data/model_A.xml'

  '/data/model_B.xml'                                               

]

......



อวตาร
ละทิ้ง

That's correct and easy enough, but how to use data loaded in data XML (by reference / external ID) in models ? As it seems that the models are interpreted before loading even first line from data files ...

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 23
1699
3
มิ.ย. 21
2666
0
ต.ค. 18
2532
2
ส.ค. 21
6377
1
พ.ค. 19
3667