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

Hi all. Like the title said, I am struggling to make the field delivery_count in sale.order become stored in the database without having to change in the default addon. Basically, I have a class inheriting procurement.group and one of the value I need is:


sale_quotationIDs = self.env['sale.order'].search([('delivery_count', '>', 0)]).mapped('id')


However, the value returns error because the delivery_count field is not stored. If you have any idea how to do so, please let me know. I would really appreciate your help and many thanks in advance.



อวตาร
ละทิ้ง
ผู้เขียน

Thank you

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

Hey,

You can redefine the field by inheriting the model and adding the param store=True but what you should be concerned about is that as soon as you make a computed field stored in the database then it stops re-computing the value on the fly, then you'll need to define a @api.depends param for the compute method to let the Odoo know based on the change in the value of which field the method needs to be triggered, just making the field stored will stop computing the correct value.

Thanks and Regards,

Divyansh

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ธ.ค. 22
4580
2
พ.ย. 17
5658
inherit search view in openerp7 แก้ไขแล้ว
5
ต.ค. 16
12352
0
มี.ค. 15
5117
Cannot inherit sale.order Odoo v8 แก้ไขแล้ว
2
มี.ค. 15
7025