When making a quotation and selecting a product_id, many fields are automatically prefilled.
For the prefilling of the field 'description' I would like to include only the field description_sale (recorded in product.template) and not product_id + decription_sale.
Where can I change this?
Thank you!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hi, Maartje
In order to achieve this feature you can simply override "product_id_change" function from "SaleOrderLine" like below,
@api.onchange('product_id')
def product_id_change(self):
res = super(SaleOrderLine, self).product_id_change()
res['name'] = self.product_id.description_sale if self.product_id.description_sale else res.get(''name', '')
return res
Hope above solution will help you. Feel free to ask in you still have the same query.
Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited
Hi Ashish,
Thank you for the description! Unfortunately I don't know the right way to edit the product_id_change function.
I went to Technical -> Models -> SalesOrderLine, However there I don't see the product_id_change function. Could you help me along?
Best,
Maartje
Correction, I went to:
Technical -> models -> sale.order.line
I run Odoo 12
Hi, Maartje
Inside any custom module you can simply override this function like below,
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
@api.onchange('product_id')
def product_id_change(self):
res = super(SaleOrderLine, self).product_id_change()
res['name'] = self.product_id.description_sale if self.product_id.description_sale else
res.get(''name', '')
return res
Else you can made changes directly inside core addons. You need to made changes inside "addons/sale/models/sale.py",
Inside this file you need to made changes in "product_id_change" method. You simply need to replace this line,
With,
name = self.product_id.description_sale
Feel free to ask in case you have any confusion related to the above point.
Thanks,
Ashish Singh
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up