Skip to Content
Menu
This question has been flagged
2 Replies
7278 Views

how to change the product description while choosing the product in the sales module during the creation of a quotation, by default Description is the combination of the fields product_id name and default_code(Internal Reference)

Please help me to change the value of Description as Internal note(description field) and also the product name as product_id



Avatar
Discard
Author
Thanks dude its working

On Thu, Apr 23, 2020 at 12:33 PM Baiju KS <baijuks@hotmail.com> wrote:

A new question How to change the Product Description in while choosing the product in sale quotation in odoo 12 on Help has been posted. Click here to access the question :

See question


Sent by Odoo S.A. using Odoo.

Best Answer

Hi Prajith,

You have to override product_id_change() in the sale.order.line and update the value for the description field.

Please check the code:

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


@api.multi
@api.onchange('product_id')
def product_id_change(self):
res = super(SaleOrderLine, self).product_id_change()
vals = {}
if self.product_id.default_code:
vals['name'] = self.product_id.name +" ["+ self.product_id.default_code +"]"
self.update(vals)
return res

Hope this helps.

Avatar
Discard
Related Posts Replies Views Activity
2
May 25
3111
0
Nov 24
788
1
Aug 24
1277
1
Aug 24
2446
2
May 23
1729