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

how can I show the brand name in the description of the products in sale.order.line.

product_brand_id = fields.Many2one('product.brand', string='Brand')

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

Hi,

Try the code below it may help you ,

from odoo import fields, models, api

class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'

@api.depends('product_id')
def _compute_name(self):
res = super(SaleOrderLine, self)._compute_name()
for line in self:
if not line.product_id:
return
if line.product_id:
line.name = line.product_id.brand_id.name
return res

Regards

อวตาร
ละทิ้ง