Hi,
Create a custom module or use your existing one. Add the following controller in controllers/main.py:
from odoo import http
from odoo.http import request
from datetime import datetime
class ProductConfiguratorController(http.Controller):
@http.route(
route='/sale/product_configurator/update_combination',
type='json',
auth='user',
methods=['POST'],
)
def sale_product_configurator_update_combination(
self,
product_template_id,
ptav_ids,
currency_id,
so_date,
quantity,
product_uom_id=None,
company_id=None,
pricelist_id=None,
**kwargs,
):
if company_id:
request.update_context(allowed_company_ids=[company_id])
product_template = request.env['product.template'].browse(product_template_id)
combination = request.env['product.template.attribute.value'].browse(ptav_ids)
product = product_template._get_variant_for_combination(combination)
pricelist = request.env['product.pricelist'].browse(pricelist_id)
product_uom = request.env['uom.uom'].browse(product_uom_id)
currency = request.env['res.currency'].browse(currency_id)
# Use _get_basic_product_information to fetch all necessary info
values = self._get_basic_product_information(
product,
pricelist,
combination,
quantity=quantity or 0.0,
uom=product_uom,
currency=currency,
date=datetime.fromisoformat(so_date),
**kwargs,
)
# ⛔ Remove computed price — set variant's list price (sales price)
values['price'] = product.lst_price
return values
def _get_basic_product_information(
self,
product,
pricelist,
combination,
quantity,
uom,
currency,
date,
**kwargs,
):
name = product.get_product_multiline_description_sale()
return {
'product_id': product.id,
'product_template_id': product.product_tmpl_id.id,
'combination': combination.ids,
'name': name,
'price': pricelist.get_product_price(product, quantity, request.env.user.partner_id),
'product_uom': uom.id if uom else product.uom_id.id,
'currency_id': currency.id,
}
Hope it helps
Did you change _compute_product_lst_price()? Because ultimately: product.lst_price = list_price + product.price_extra