Odoo 10 Правильный способ переопределить значение поля выбора по умолчанию - PullRequest
0 голосов
/ 07 декабря 2018

Я пытаюсь переопределить поле выбора типа продукта product_template. Значение по умолчанию.

Исходное поле:

class ProductTemplate(models.Model):
    _name = "product.template"
    _inherit = ['mail.thread']
    _description = "Product Template"
    _order = "name"

type = fields.Selection([
    ('consu', _('Consumable')),
    ('service', _('Service'))], string='Product Type', default='consu', required=True,
    help='A stockable product is a product for which you manage stock. The "Inventory" app has to be installed.\n'
     'A consumable product, on the other hand, is a product for which stock is not managed.\n'
     'A service is a non-material product you provide.\n'
     'A digital content is a non-material product you sell online. The files attached to the products are the one that are sold on '
     'the e-commerce such as e-books, music, pictures,... The "Digital Product" module has to be installed.')

class ProductTemplate(models.Model):
    _inherit = 'product.template'

    type = fields.Selection(selection_add=[('product', 'Stockable Product')])

Мое переопределено type field.

class product_template(models.Model):
    _inherit = "product.template"

    type = fields.Selection(default='product')

Это правильно, или я должен переопределить его каким-то другим способом?

...