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

I have created a new form and  i choose a PO as a source document and that field is as follow.


purchase_order = fields.Many2one('purchase.order', string='PO Number')

AFTER selecting a PO i want that vendor from that Purchase Order automatically 
fill my vendor field in that form.
i have a simple many2one field for vendors. 
Kindly help me with this problem i shall be very thankful.



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

Hi,

For this you can use the related fields.

purchase_order = fields.Many2one('purchase.order, string="PO")
partner_id = fields.Many2one('res.partner', string="Vendor", related='purchase_order.partner_id')


Thanks

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

hey thanks for replying. it is giving error KeyError: 'purchase_field'. can you tell me what it is?

It's purchase_order.partner_id in the related, see updated Answer

ผู้เขียน

Man you are awesome! Thank You soo much

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ธ.ค. 20
4069
1
ส.ค. 22
4515
odoo many2one as selection field แก้ไขแล้ว
2
ก.ย. 18
4431
1
มี.ค. 24
1543
0
ม.ค. 24
1871