def create(self, cr, uid, vals, context=None):
''' Store the initial standard price in order to be able to retrieve the cost of a product template for a given date'''
product_template_id = super(product_template, self).create(cr, uid, vals, context=context)
- self.create_variant_ids(cr, uid, [product_template_id], context=context)
+ if not context or "create_product_product" not in context:
+ self.create_variant_ids(cr, uid, [product_template_id], context=context)
self._set_standard_price(cr, uid, product_template_id, vals.get('standard_price', 0.0), context=context)
return product_template_id
'res_id': product.product_tmpl_id.id,
'target': 'new'}
+ def create(self, cr, uid, vals, context=None):
+ if context is None:
+ context = {}
+ context.update(create_product_product=True)
+ return super(product_product, self).create(cr, uid, vals, context=context)
+
class product_packaging(osv.osv):
_name = "product.packaging"
<field name="attribute_id" ref="product_attribute_2"/>
</record>
+ <record id="product_attribute_3" model="product.attribute">
+ <field name="name">Wi-Fi</field>
+ </record>
+ <record id="product_attribute_value_5" model="product.attribute.value">
+ <field name="name">2.4 GHz</field>
+ <field name="attribute_id" ref="product_attribute_3"/>
+ </record>
+
<record id="product_product_4" model="product.product">
<field name="name">iPad Retina Display</field>
<field name="categ_id" ref="ipad"/>
<field name="attribute_id" ref="product_attribute_2"/>
<field name="value_ids" eval="[(6,0,[ref('product.product_attribute_value_3'), ref('product.product_attribute_value_4')])]"/>
</record>
+ <record id="product_attribute_line_3" model="product.attribute.line">
+ <field name="product_tmpl_id" ref="product_product_4_product_template"/>
+ <field name="attribute_id" ref="product_attribute_3"/>
+ <field name="value_ids" eval="[(6,0,[ref('product.product_attribute_value_5')])]"/>
+ </record>
<record id="product_product_4_product_template" model="product.template">
- <field name="variant_ids" eval="[(6,0,[ref('product.product_attribute_line_1'), ref('product.product_attribute_line_2')])]"/>
+ <field name="variant_ids" eval="[(6,0,[ref('product.product_attribute_line_1'), ref('product.product_attribute_line_2'), ref('product.product_attribute_line_3')])]"/>
</record>
<record id="product_attribute_price_1" model="product.attribute.price">
<field name="variant_ids" eval="[(6,0,[ref('product.product_attribute_value_2')])]"/>
</record>
- <record id="product_attribute_line_3" model="product.attribute.line">
+ <record id="product_attribute_line_4" model="product.attribute.line">
<field name="product_tmpl_id" ref="product_product_11_product_template"/>
<field name="attribute_id" ref="product_attribute_1"/>
<field name="value_ids" eval="[(6,0,[ref('product.product_attribute_value_1'), ref('product.product_attribute_value_2')])]"/>
</record>
<record id="product_product_11_product_template" model="product.template">
- <field name="variant_ids" eval="[(6,0,[ref('product.product_attribute_line_3')])]"/>
+ <field name="variant_ids" eval="[(6,0,[ref('product.product_attribute_line_4')])]"/>
</record>
<record id="product_attribute_price_2" model="product.attribute.price">