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

Hello, I have 2 simple models:

 the first one is to create a product and it has name and quantity

the other one is to record how many products sold. 

I want to get the quantity value from the first model onto the second one and update it if something is sold, how can I do that? 

Thanks,,,

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

Hi,

You can create a Many2one field in the second model with first model as comodel. Then you can access the quantity field of first model as "many2one_fleld_id.quantity".

Regards

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 23
4305
0
เม.ย. 23
3178
multiple models inherited in a class แก้ไขแล้ว
5
มิ.ย. 21
18199
1
มี.ค. 21
5973
Override the field from another module แก้ไขแล้ว
1
พ.ย. 19
3891