vendor = fields.Many2one('product.supplierinfo', 'Vendors', domain="[('product_tmpl_id', '=', product_id.id)]")
@api.onchange('product_id')
def onchange_product(self):
if self.product_id:
self.product_desc = self.product_id.name
# self.vendor_ids = [(6, 0, [seller.name.id for seller in self.product_id.seller_ids])]
self.vendor_ids = [(6, 0, self.product_id.seller_ids.ids)]
print('self.vendor_ids',self.vendor_ids)
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
Hi,
Please try this code:vendor_ids = fields.Many2many('product.supplierinfo', 'Vendors', compute='_compute_vendor_ids')
vendor = fields.Many2one('product.supplierinfo', 'Vendors', domain="[('id', 'in', vendor_ids)]")
@api.depends('product_id')
def _compute_vendor_ids(self):
for record in self:
if record.product_id:
record.product_desc = record.product_id.name
value = [data.id for data in record.product_id.seller_ids if data]
if value:
record.vendor_ids = value
Hope it helps
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
1
ก.ย. 25
|
2009 | ||
|
1
มิ.ย. 25
|
2031 | ||
|
3
ก.ค. 25
|
3616 | ||
|
1
พ.ค. 25
|
1744 | ||
|
4
พ.ค. 25
|
3072 |