[FIX] sale_management: fix pricelist computation for optional products
1. Have a product with cost A 2. Have a pricelist which modify the price of the product to B based on the quantity 3. Create a sale order with the pricelist. Under the "Optional Products" tab add the product and match the pricelist requirements No price modification will occur, because there is no reaction to the quantity change opw-2480696 closes odoo/odoo#68494 X-original-commit: ab24134abb81399acd6ee49c4553aa0930384e37 Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com> Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
@@ -220,11 +220,19 @@ class SaleOrderOption(models.Model):
|
||||
return [('line_id', '=', False)]
|
||||
return [('line_id', '!=', False)]
|
||||
|
||||
@api.onchange('product_id', 'uom_id')
|
||||
@api.onchange('product_id', 'uom_id', 'quantity')
|
||||
def _onchange_product_id(self):
|
||||
if not self.product_id:
|
||||
return
|
||||
product = self.product_id.with_context(lang=self.order_id.partner_id.lang)
|
||||
product = self.product_id.with_context(
|
||||
lang=self.order_id.partner_id.lang,
|
||||
partner=self.order_id.partner_id,
|
||||
quantity=self.quantity,
|
||||
date=self.order_id.date_order,
|
||||
pricelist=self.order_id.pricelist_id.id,
|
||||
uom=self.uom_id.id,
|
||||
fiscal_position=self.env.context.get('fiscal_position')
|
||||
)
|
||||
self.name = product.get_product_multiline_description_sale()
|
||||
self.uom_id = self.uom_id or product.uom_id
|
||||
# To compute the discount a so line is created in cache
|
||||
|
||||
Reference in New Issue
Block a user