From 2df6a0ee81e910de01cd8fb5109c08b31c02e954 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Wed, 19 May 2021 10:06:17 +0000 Subject: [PATCH] [FIX] sale_product_matrix: avoid traceback when using Order Grid Entry - Enable 'product configurator' and 'variant grid entry' - Go to product [DEMO]: - Add an optional product. - Go to the variants tab and add some variants - Select 'order grid entry' - Remove all the variants - Create a SO adding [DEMO] Traceback will occur opw-2439764 closes odoo/odoo#71048 X-original-commit: da9541089fcf33c778748c4c3da0d81f6b5ea227 Signed-off-by: agr-odoo --- addons/sale_product_matrix/models/product_template.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/sale_product_matrix/models/product_template.py b/addons/sale_product_matrix/models/product_template.py index 0ca6f2ef1e8..8440b5b3620 100644 --- a/addons/sale_product_matrix/models/product_template.py +++ b/addons/sale_product_matrix/models/product_template.py @@ -14,5 +14,8 @@ class ProductTemplate(models.Model): def get_single_product_variant(self): res = super(ProductTemplate, self).get_single_product_variant() - res['mode'] = self.product_add_mode + if self.has_configurable_attributes: + res['mode'] = self.product_add_mode + else: + res['mode'] = 'configurator' return res