From 74e116fcc137a6a51cc9684435d7752ffcd5b66d Mon Sep 17 00:00:00 2001 From: rde Date: Mon, 23 Oct 2017 18:32:18 +0200 Subject: [PATCH] [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. --- views/website_sale_templates.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/website_sale_templates.xml b/views/website_sale_templates.xml index ff9f59c8ed9..e1d3b65e4c2 100644 --- a/views/website_sale_templates.xml +++ b/views/website_sale_templates.xml @@ -3,7 +3,7 @@