Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
1405 Visninger

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')

Avatar
Kassér
Bedste svar

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

Avatar
Kassér