Hello everyone,
I have an onchange method in product.template model:
@api.one
@api.depends('base_product')
def onchange_base_product(self):
if self.base_product:
if self.base_product.product_variant_count > 1:
self.base_has_variant = True
else:
self.base_has_variant = False
And I have three fields in form view:
<field name="base_has_variant" invisible="1"/> <field name="base_product" domain="[('product_spesification', '=', 8)]" /> <field name="base_product_variants" domain="[('product_tmpl_id', '=', base_product)]" attrs="{'invisible': [('base_has_variant', '!=', True)]}"/>In sale.order model when I added product in sale.order.line, I am clicking "create and edit".
The window of product.template is opening and I am choosing base_product fields and there is nothing happens.
Compute method is not working and indirectly domain is not working for the field called by 'base_product_variants'.