diff options
| author | Sébastien Theys <seb@odoo.com> | 2019-06-17 09:42:16 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2019-06-17 10:52:01 +0000 |
| commit | e05442fe191aff4686d3adc4d7f689deef13e730 (patch) | |
| tree | 5f2f9df548ec861ad56c8af900027218d0ca0f75 /addons/product/data | |
| parent | 7316111aafbf4740ded06376c635a722add8bfbf (diff) | |
[IMP] product, *: clean test and demo set up with attribute lines
* = account, mrp, purchase_stock, sale, sale_product_configurator,
stock_account, website_sale
It is always better to create the product template attribute lines before
creating the variants. In a following commit, this will become mandatory.
The variants that are created should always match the combination of attributes
set on the template.
Finally explicitly call `create_variant_ids` when possible instead of reassigning
the attribute lines to implicitly call `create_variant_ids`.
closes odoo/odoo#34122
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/product/data')
| -rw-r--r-- | addons/product/data/product_demo.xml | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/addons/product/data/product_demo.xml b/addons/product/data/product_demo.xml index 1e7a7d3a37d..a46ab878d1a 100644 --- a/addons/product/data/product_demo.xml +++ b/addons/product/data/product_demo.xml @@ -183,6 +183,19 @@ <field name="uom_po_id" ref="uom.product_uom_unit"/> <field name="description_sale">160x80cm, with large legs.</field> </record> + + <!-- the product template attribute lines have to be defined before creating the variants --> + <record id="product_template_attribute_line_1" model="product.template.attribute.line"> + <field name="product_tmpl_id" ref="product_product_4_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_template_attribute_line_2" model="product.template.attribute.line"> + <field name="product_tmpl_id" ref="product_product_4_product_template"/> + <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_product_4" model="product.product"> <field name="default_code">FURN_0096</field> <field name="standard_price">500.0</field> @@ -216,21 +229,6 @@ <field name="image" type="base64" file="product/static/img/table01.png"/> </record> - <record id="product_template_attribute_line_1" model="product.template.attribute.line"> - <field name="product_tmpl_id" ref="product_product_4_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_template_attribute_line_2" model="product.template.attribute.line"> - <field name="product_tmpl_id" ref="product_product_4_product_template"/> - <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_product_4_product_template" model="product.template"> - <field name="attribute_line_ids" eval="[(6,0,[ref('product.product_template_attribute_line_1'), ref('product.product_template_attribute_line_2')])]"/> - </record> - <record id="product_product_5" model="product.product"> <field name="name">Corner Desk Right Sit</field> <field name="categ_id" ref="product_category_5"/> @@ -311,35 +309,35 @@ <field name="image" type="base64" file="product/static/img/product_product_10-image.png"/> </record> - <record id="product_product_11" model="product.product"> + <record id="product_product_11_product_template" model="product.template"> <field name="name">Conference Chair</field> <field name="categ_id" ref="product_category_5"/> <field name="standard_price">14</field> <field name="list_price">16.50</field> <field name="type">consu</field> - <field name="weight">0.01</field> <field name="uom_id" ref="uom.product_uom_unit"/> <field name="uom_po_id" ref="uom.product_uom_unit"/> - <field name="default_code">E-COM12</field> - <field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_1')])]"/> <field name="image" type="base64" file="product/static/img/product_product_11-image.png"/> </record> - <record id="product_product_11b" model="product.product"> - <field name="name">Conference Chair</field> - <field name="default_code">E-COM13</field> - <field name="weight">0.01</field> - <field name="product_tmpl_id" ref="product_product_11_product_template"/> - <field name="attribute_value_ids" eval="[(6,0,[ref('product.product_attribute_value_2')])]"/> - </record> + <!-- the product template attribute lines have to be defined before creating the variants --> <record id="product_template_attribute_line_4" model="product.template.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="attribute_line_ids" eval="[(6,0,[ref('product.product_template_attribute_line_4')])]"/> + <record id="product_product_11" model="product.product"> + <field name="default_code">E-COM12</field> + <field name="weight">0.01</field> + <field name="product_tmpl_id" ref="product_product_11_product_template"/> + <field name="attribute_value_ids" eval="[(6, 0, [ref('product.product_attribute_value_1')])]"/> + </record> + <record id="product_product_11b" model="product.product"> + <field name="default_code">E-COM13</field> + <field name="weight">0.01</field> + <field name="product_tmpl_id" ref="product_product_11_product_template"/> + <field name="attribute_value_ids" eval="[(6, 0, [ref('product.product_attribute_value_2')])]"/> </record> <!-- |
