odoo/odoo#195721

Created by Bugfix, Levi Siuzdak
Merged at c8b3f5367853226916e36002ffe7b28e365fd090

Statuses:

label
odoo-dev:16.0-opw-4263554-no_price_strikethrough_on_prevent_zero_price_sale-sile
head
e50772fe651d18494e74e15352fb0b1e1ef4c87c
merged
8 months ago by Bugfix, Levi Siuzdak
odoo/odoo
16.0 #195721
17.0 #197336
saas-17.4 #197415
18.0 #197418
saas-18.1 #197423
saas-18.2 #198013
saas-18.3
saas-18.4
19.0
master #198040

[FIX] website_sale: don't show discount when not available for sale

Versions

  • 16.0+

Steps

  1. Go to Settings / Website;
  2. enable the following options:
    • Comparison Price;
    • Pricelists: Advanced price rules;
    • Prevent Sale of Zero Priced Product;
  3. create a pricelist setting all prices to 0;
  4. make pricelist selectable;
  5. set pricelist's Discount Policy to Show public price & discount to customer;
  6. go to /shop;
  7. query the search bar.

Issue

A strikethrough price is added, despite the item not being available for sale.

Cause

The _search_render_results_prices method still checks for has_discounted_price and compare_list_price after it already knows the product isn't available for sale.

Solution

If prevent_zero_price_sale is given for the product, do an early return, disregarding the has_discounted_price and compare_list_price options.

opw-4263554