diff --git a/addons/product/models/product_supplierinfo.py b/addons/product/models/product_supplierinfo.py index db1b7a05311..b51dd15cbdf 100644 --- a/addons/product/models/product_supplierinfo.py +++ b/addons/product/models/product_supplierinfo.py @@ -51,9 +51,7 @@ class SupplierInfo(models.Model): date_end = fields.Date('End Date', help="End date for this vendor price") product_id = fields.Many2one( 'product.product', 'Product Variant', check_company=True, - domain="[('product_tmpl_id', '=', parent.id)] if context.get('base_model_name') == 'product.template' else" - " [('product_tmpl_id', '=', parent.product_tmpl_id)] if context.get('base_model_name') == 'product.product' else" - " [('product_tmpl_id', '=', product_tmpl_id)] if product_tmpl_id else []", + domain="[('product_tmpl_id', '=', product_tmpl_id)] if product_tmpl_id else []", default=_default_product_id, help="If not set, the vendor price will apply to all variants of this product.") product_tmpl_id = fields.Many2one( diff --git a/addons/product/views/product_supplierinfo_views.xml b/addons/product/views/product_supplierinfo_views.xml index 00cdc08f601..da495c47625 100644 --- a/addons/product/views/product_supplierinfo_views.xml +++ b/addons/product/views/product_supplierinfo_views.xml @@ -106,7 +106,8 @@ + groups="product.group_product_variant" + domain="[('product_tmpl_id', '=', context.get('default_product_tmpl_id'))] if context.get('default_product_tmpl_id') else [('product_tmpl_id', '=', product_tmpl_id)]"/>