From 0ac7635b54c5c596ab3609560315521df8f81fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Mon, 27 May 2019 10:03:13 +0000 Subject: [PATCH] [FIX] sale: fix get_combination_info RPC when product_id given MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow up of 51ef8514eaddaebbdfee73230cfe955735d02f67 The RPC would fail to return the correct value for `is_combination_possible` if a product_id is given instead of a combination. opw-2003069 closes odoo/odoo#33677 Signed-off-by: Sébastien Theys --- addons/sale/controllers/product_configurator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/sale/controllers/product_configurator.py b/addons/sale/controllers/product_configurator.py index 30d37fdde14..689603bdc3c 100644 --- a/addons/sale/controllers/product_configurator.py +++ b/addons/sale/controllers/product_configurator.py @@ -48,6 +48,10 @@ class ProductConfiguratorController(http.Controller): res = product_template._get_combination_info(combination, int(product_id or 0), int(add_qty or 1), pricelist) if 'parent_combination' in kw: parent_combination = request.env['product.template.attribute.value'].browse(kw.get('parent_combination')) + if not combination.exists() and product_id: + product = request.env['product.product'].browse(int(product_id)) + if product.exists(): + combination = product.product_template_attribute_value_ids res.update({ 'is_combination_possible': product_template._is_combination_possible(combination=combination, parent_combination=parent_combination), })