1# -*- coding: utf-8 -*-
2# Part of Odoo. See LICENSE file for full copyright and licensing details.
3from odoo import api, models, fields
4
5
6class ProductTemplate(models.Model):
7    _inherit = 'product.template'
8
9    product_add_mode = fields.Selection([
10        ('configurator', 'Product Configurator'),
11        ('matrix', 'Order Grid Entry'),
12    ], string='Add product mode', default='configurator', help="Configurator: choose attribute values to add the matching \
13        product variant to the order.\nGrid: add several variants at once from the grid of attribute values")
14
15    def get_single_product_variant(self):
16        res = super(ProductTemplate, self).get_single_product_variant()
17        if self.has_configurable_attributes:
18            res['mode'] = self.product_add_mode
19        else:
20            res['mode'] = 'configurator'
21        return res
22