[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 <agr-odoo@users.noreply.github.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2021-05-19 15:18:34 +00:00
parent 3c71695e2a
commit 2df6a0ee81
@@ -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