summaryrefslogtreecommitdiff
path: root/addons/product_matrix/data
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2019-08-26 08:38:56 +0000
committerSébastien Theys <seb@odoo.com>2019-08-26 13:01:13 +0000
commit22a11a6f4d0b08a56712fafd0f87a2e7bb5b00ec (patch)
treebb88f34b8bc298c31aa3af5c83f1f393a7f108bc /addons/product_matrix/data
parent191213bca2582ed60c92769a8aa8a17cca0432e6 (diff)
[REF] product, *: save product.template.attribute.value on variants
* account, hr_expense, mrp, sale, sale_product_configurator, stock_account, website_sale, website_sale_comparison Before this commit, the `product.attribute.value` were stored on the variants. This required filtering of attribute lines to find the appropriate matching `product.template.attribute.value` that were used in most of the business code, such as when computing the `price_extra`. This also prevented to have multiple attribute lines for the same attribute, which is needed to handle use cases such as grape varieties for wine products. This will be done in the following commit. After this commit, the combination of `product.template.attribute.value` will be directly stored on the product variant. Other changes ============= Add `combination_indices` on product, which allows to quickly find a variant matching a combination (1 simple indexed equality query as opposed to 1 query with as many joins as there are attribute lines), and to add an easy SQL constraint to ensure active combination uniqueness. Add active field on `product.template.attribute.line` and `product.template.attribute.value`, with the same behavior as variants: They become archived if they can't be unlinked. This allows to keep the database consistent, such as archived variants correctly keeping all their values, sales order lines keeping their custom and no_variant. This is done with the help of `ondelete=restrict` on the corresponding m2m fields, and the `unlink` methods falling back to archiving when `unlink` is restricted. Part of task-1912579 PR: #32946
Diffstat (limited to 'addons/product_matrix/data')
-rw-r--r--addons/product_matrix/data/product_matrix_demo.xml2
1 files changed, 0 insertions, 2 deletions
diff --git a/addons/product_matrix/data/product_matrix_demo.xml b/addons/product_matrix/data/product_matrix_demo.xml
index c388edcb252..eb6cbff993a 100644
--- a/addons/product_matrix/data/product_matrix_demo.xml
+++ b/addons/product_matrix/data/product_matrix_demo.xml
@@ -130,6 +130,4 @@
<field name="attribute_id" ref="product.product_attribute_2"/>
<field name="value_ids" eval="[(6, 0, [ref('product_attribute_value_color_1'), ref('product_attribute_value_color_2'), ref('product_attribute_value_color_3'), ref('product_attribute_value_color_4')])]"/>
</record>
-
- <function model="product.template" name="create_variant_ids" eval="([ref('product_matrix.matrix_product_template_shirt')])"/>
</odoo>