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

hi all,

can i add a Many2one field in a model which will not save data in the database like computed field or related field where we can define store=False or store=True? if yes, how? 

OR

any other idea to have Many2one field which will not store data in database?

regards


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

you can define many2one field as non stored field like

order_id = fields.Many2one('sale.order', compute="_compute_order_id")

def _compute_order_id(self):
for record in self:
# get/compute order_id from other field or based on your business logic
record.order_id = 2
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
เม.ย. 23
2873
2
ก.พ. 25
40663
2
พ.ย. 22
2919
1
ก.พ. 22
7938
2
ธ.ค. 21
4209