3

My goal is to make the "Description" (name) field located in sale.order.line in order to show the products "Sales Description"(description_sale)....and NOT the products "Name"+"Sales Description" as per default.

I've seen someone said i have to override the function product_id_change but i don't know how to do it.

Thanks in advance,

Gabin
  • 61
  • 8

1 Answers1

5

Try this:

@api.onchange('product_id')
def product_id_change(self):
    res = super(classname, self).product_id_change()
    self.name = self.product_id.description_sale if self.product_id and self.product_id.description_sale else self.product_id.name
    return res
Himanshu Sharma
  • 706
  • 3
  • 10
  • This is simpler than I thought, I had indeed a problem with my super() because I called an unnecessary parameter. Thanks for the help, it works ! – Gabin Jun 24 '21 at 09:55