rde 74e116fcc1 [FIX] website_sale_coupon: prevent concurent t-if on same element
Before this commit, website_sale_coupon and website_sale_options (which are not
dependant) were both setting an attribute name="t-if" on the same element (same
xpath).

*website_sale_coupon: hide cart line qty widget if line is a coupon
(reward_line)
*website_sale_options: hide cart line qty widget if line is an optional product

The problem was that only one of the condition would be considered:
  - On saas-14: always the one from website_sale_coupon, because qweb would
    sort inherited views by [priority, name, id]
  - On v18: always the one from the last installed module of these 2 would be
    considered, because commit #dbb931976fd102a1eceea4ebf195efea7576f260 change
    the inherited views order in qweb [priority, id]. Therefore, last installed
    module will have higher ID on its view, being interpreted last.

Now, both coupon and optional product lines have their qty correctly hidden.
To do so, we had to change an attribute t-if by an attribute style setting the
display to none. We can't change the xpath to a parent since it is a table
element and it would remove a TD, breaking the HTML. We can't either add a
container because of the themes that may conflicts.

To reproduce on v18:

  - Install website_sale_coupon and website_sale_options
  - Create a promotion code
  - Add item to cart with it's optionnal product and go to checkout
  - Add promotion code
  - If you installed website_sale_coupon first, the coupon cart line will
    display the qty twice (t-if overrided by website_sale_options)
  - If you installed website_sale_options first, the optionnal product car
    line will display the qty twice (t-if overrided by website_sale_coupon)

To reproduce on saas-14:

  - Do the same 4 first steps
  - Optional product cart line will display the qty twice

Website_sale_options and website_sale_coupon both xpath and t-if the same
element.
The module that has been installed last will have the upper hand on the
condition and only its condition will be applied.

Now, it correctly take care of both conditions.
2017-10-27 17:37:20 +02:00
S
Description
No description provided
LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%