diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py index 10271584579..166524b02d1 100644 --- a/addons/product/models/product_template.py +++ b/addons/product/models/product_template.py @@ -265,6 +265,21 @@ class ProductTemplate(models.Model): template = super(ProductTemplate, self).create(vals) if "create_product_product" not in self._context: template.create_variant_ids() + + # This is needed to set given values to first variant after creation + related_vals = {} + if vals.get('barcode'): + related_vals['barcode'] = vals['barcode'] + if vals.get('default_code'): + related_vals['default_code'] = vals['default_code'] + if vals.get('standard_price'): + related_vals['standard_price'] = vals['standard_price'] + if vals.get('volume'): + related_vals['volume'] = vals['volume'] + if vals.get('weight'): + related_vals['weight'] = vals['weight'] + if related_vals: + template.write(related_vals) return template @api.multi