mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Adds boolean on the `product.template` form to force the 'dynamic' mode for NOT creating variants on `product.template` save, but rather when added to sale orders.
14 lines
389 B
Python
14 lines
389 B
Python
from odoo import fields, models
|
|
|
|
|
|
class ProductTemplate(models.Model):
|
|
_inherit = 'product.template'
|
|
|
|
always_variant_on_so = fields.Boolean(string='Always create variants on SO Lines')
|
|
|
|
def has_dynamic_attributes(self):
|
|
self.ensure_one()
|
|
if self.always_variant_on_so:
|
|
return True
|
|
return super(ProductTemplate, self).has_dynamic_attributes()
|