تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
1413 أدوات العرض

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

الصورة الرمزية
إهمال