تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
6305 أدوات العرض

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
5
أبريل 25
15888
2
نوفمبر 18
2597
0
نوفمبر 18
2508
1
نوفمبر 18
5714
5
فبراير 18
4818