Commit Graph
9 Commits
Author SHA1 Message Date
Jeremy Kersten fef7ec7c97 [FIX] website,*: remove useless route from sitemap
preparation for cleaning of v13
task-2065018

closes odoo/odoo#39051

X-original-commit: 8a0fc6476c70a4126043de3b3efbd1096e41f968
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-10-18 14:59:02 +00:00
Nicolas Lempereur 1eec5860e2 [FIX] website_sale_wishlist: unlink instead of archive
Since 11.0 88b75f150 the wishlist can't contain duplicates: thus if we
remove an element from wishlist (by adding it to cart or removing) there
is an error next times it is added (since the product is already in
wishlist but archived until next garbage collection).

opw-2074843
closes #37255

closes odoo/odoo#37287

X-original-commit: 0b085ce0800f410d5f88615fd18bd633c0d48fb5
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-09-23 13:01:47 +00:00
Sébastien Theys f8dad1bb4b [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
2018-12-18 16:21:32 +00:00
Jeremy Kersten 2bc2ea0039 [FIX] website_sale_wishlist: allow the public user to delete product from the wishlist
Search 'id', 'in' instead to browse old record
Update session wishlist_ids when a product is deleted
Garbage old archived public wishlist, now we unlink theme directly, but for previous version
2018-08-29 11:56:27 +02:00
Jeremy Kersten 5d0962698a [FIX] website_sale_wishlist: store wishlist in session + remove new_price
Now, we save wishlist_ids in session instead to save session_id in wishlist table
Remove useless field price_new.
2018-08-22 15:24:21 +02:00
Valentin Löfberg 80029cae36 [FIX] website_sale_wishlist: allow deletion of wishlist item when not connected
Add controller to remove (archive) an item from the wishlist.
Rpc cannot be used because user can be public

Adding tour test

task-1834888
This commit closes #24135
2018-04-11 20:54:55 +02:00
Jeremy Kersten 830fed2601 [FIX] website_sale_wishlist: fix to make wishlist available for public user
Fix/imp about the #19777

Replace cron of garbage_collector by a call from autovaccum. Don't try to find
which session is expired or not to avoid to check each one by one, but use a
stupid heuristic to delete all old session older than 5 weeks by default.
(overridable in autovaccum: model.power_on(**dict(wishlist_week=10)) e.g.)

Use 'display: none' instead of class hidden, to avoid flickering at load and
let jquery work with .show / .hide without removeClass('hidden').
Without it, the animation of the first product that you add in your wishlist
will be wrong because Wishlist menu is not visible while you don't refresh.

Remove all old test that check if we was the public user or not and that make
the PR not working ;)

Courtesy of @yajo for dev, and @rdeodoo for quick review/testing
2017-09-30 12:21:27 +02:00
Jairo Llopis 88b75f150d [IMP] website_sale_wishlist: Allow public users to wishlist
Current behavior before this patch:

- Only authenticated users were able to set items as wishlisted.
- A product template is displayed as wishlisted if the first variant is so.

Desired behavior after this patch:

- All users are able to wishlist items.
- When a user logs in, his dangling wishlists join him.
- A product template is displayed as wishlisted when any of its variants is so.

This commit closes #19777
2017-09-30 12:21:27 +02:00
Jeremy Kersten 2be56f9d81 [ADD] website_sale_wishlist: add wishlist feature on eCommerce 2017-02-24 20:29:17 +01:00