summaryrefslogtreecommitdiff
path: root/addons/product/data
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2018-12-18 16:21:32 +0000
committerSébastien Theys <seb@odoo.com>2018-12-18 16:21:32 +0000
commitf8dad1bb4b712d8f34035420ef1f6e484c638f5b (patch)
tree27f5c3cbaf1afd14dd8e6483f85490088b423062 /addons/product/data
parent4e01d5f702d514f065d779b0adb5f4cd5e4f6392 (diff)
[FIX] product,(website_)sale(*): fix product configurator
This commit has several parts: - fix ordering of attributes and values - fix/create python logic (notably for checking the possibility of a combination and for price computing) - fix currency - display correct info on the views without the need of JS (prevent flickering) - fix various issues with website and SO - add a lot of tests (both unit and tour) ================================================================================ *** Make consistent the filtering and ordering of product variants *** Filter & Check possibility ========================== The first variant shown on the website should always be possible. When activating the customize "list view of variants", we don't want to show impossible combination on the list. We also don't want the user to be able to add to cart an impossible variant. Show appropriate messages when no combination is possible. Order ===== We want the variant order to be consistent with what the user selected with the sequence fields. The display order on the website should be the same than the display on the various backend views. This implies also fixing the order of: - product.attribute - product.attribute.value - product.template.attribute.line - product.template.attribute.value The general order is now: (parent,) sequence, id. Before, it was already a mix of those, but not always in the same order, and not every key for every model. The name has been removed from the order: either we sequence them correctly, or we want them in the creation order. On the website, the first combination shown by the python should be the same as the one that will be computed by the JS to prevent flickering. Ideally there should be no RPC at page loading if the python has computed everything correctly, but it is currently not possible to achieve because the view logic for website_sale_stock is only in JS. ================================================================================ *** Fix product template and variant price computation *** Move and improve the get_combination_info method: - take into account tax included/excluded settings (B2B/B2C) - take into account pricelist discount policy (striked price) - fix inconsistencies when price after pricelist would be 0 - use proper rounding and discount compute with the currency helper methods - fix an issue where context "partner" would have a mix of id and recordset ================================================================================ *** Fix currency conversions *** The list_price and lst_price of a product are always encoded using the currency of the product. The results of "combination info" are always returned using the currency of the pricelist if given, or the currency of the product. The prices on an order (line) are encoded with the currency of its pricelist. ================================================================================ *** Fix dynamic variants access rights *** Public users on the e-commerce should be able to create product variants if the configuration of the attributes of the product template is set as "dynamic". This uses "sudo" to bypass create security rules for public users. Multiple checks are done to ensure that it creates a valid product variant. ================================================================================ *** Miscellaneous bugs, tracebacks and necessary improvements *** In general: - correctly show warning when no variant is possible - don't let user add to cart an impossible variant (from optional product modal or from any RPC), both in interface and controller logic - fix as much flickering as possible by correctly pre-computing in python/views - move business logic from controllers to models - correctly add no_variant and is_custom values on the SO line description Sale order: - fix traceback when emptying the product_id field from configurator website_sale: - correctly compute first image / carousel, and correctly swap images when changing variants, without duplicate image or zoom problems - don't use list view of variants when it doesn't make sense - added missing product info when adding a no_variant attribute to cart - fix cart accessory product computation website_sale_wishlist: - fix it with dynamic variants, no_variant and is_custom website_sale_comparison: - fix it with dynamic variants (comparison and alternative products) website_sale_stock: - fix it in general (some flickering still present) ================================================================================ Authored by @seb-odoo with contribution from @awa-odoo task-1910821 closes odoo/odoo#28079
Diffstat (limited to 'addons/product/data')
-rw-r--r--addons/product/data/product_demo.xml6
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/product/data/product_demo.xml b/addons/product/data/product_demo.xml
index d4299a2dd51..c1b75e8290e 100644
--- a/addons/product/data/product_demo.xml
+++ b/addons/product/data/product_demo.xml
@@ -128,26 +128,32 @@
<record id="product_attribute_1" model="product.attribute">
<field name="name">Legs</field>
+ <field name="sequence">1</field>
</record>
<record id="product_attribute_value_1" model="product.attribute.value">
<field name="name">Steel</field>
<field name="attribute_id" ref="product_attribute_1"/>
+ <field name="sequence">1</field>
</record>
<record id="product_attribute_value_2" model="product.attribute.value">
<field name="name">Aluminium</field>
<field name="attribute_id" ref="product_attribute_1"/>
+ <field name="sequence">2</field>
</record>
<record id="product_attribute_2" model="product.attribute">
<field name="name">Color</field>
+ <field name="sequence">2</field>
</record>
<record id="product_attribute_value_3" model="product.attribute.value">
<field name="name">White</field>
<field name="attribute_id" ref="product_attribute_2"/>
+ <field name="sequence">1</field>
</record>
<record id="product_attribute_value_4" model="product.attribute.value">
<field name="name">Black</field>
<field name="attribute_id" ref="product_attribute_2"/>
+ <field name="sequence">2</field>
</record>
<record id="product_attribute_3" model="product.attribute">