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

I have two fields in model res.contract "society_id" and "phase_id" inherited from "file" model. And in "file" model these two fields are related. I think that is why it is not saving these fields in my current model. I have used force_save = "1" attribute but still no luck. Any help?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

In the file model, you are not saving the related fields into the database. In the file model write like this:

phase_id = fields.Many2one(comodel_name='your.model', string='Your String',
related='model_field.phase_id', store='True')
society_id = fields.Many2one(comodel_name='your.model', string='Your String',
related='model_field.society_id', store='True')

Now you should get the value.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

for me in odoo11 i have to use store=True in py and force_save="1" in xml

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
5
เม.ย. 25
15872
2
พ.ย. 18
2594
0
พ.ย. 18
2503
1
พ.ย. 18
5693
5
ก.พ. 18
4809