Skip to content

Commit 9ba689e

Browse files
committed
[FIX] website_sale_product_assortment: Products grid feature is not working, recover it
1 parent 9db4f63 commit 9ba689e

8 files changed

Lines changed: 90 additions & 107 deletions

File tree

website_sale_product_assortment/__manifest__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"website_sale_product_assortment/static/src/js/assortment_list_preview.esm.js",
2121
],
2222
"web.assets_tests": [
23-
"website_sale_product_assortment/static/src/js/no_purchase_tour.js",
24-
"website_sale_product_assortment/static/src/js/no_restriction_tour.js",
25-
"website_sale_product_assortment/static/src/js/no_show_tour.js",
23+
"website_sale_product_assortment/static/src/js/no_purchase_tour.esm.js",
24+
"website_sale_product_assortment/static/src/js/no_restriction_tour.esm.js",
25+
"website_sale_product_assortment/static/src/js/no_show_tour.esm.js",
2626
],
2727
},
2828
}

website_sale_product_assortment/static/src/js/assortment_list_preview.esm.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import {renderToElement} from "@web/core/utils/render";
2+
import {rpc} from "@web/core/network/rpc";
3+
import publicWidget from "@web/legacy/js/public/public_widget";
24

3-
var WebsiteSaleProductAssortment = {
5+
publicWidget.registry.WebsiteSaleProductAssortment = publicWidget.Widget.extend({
46
selector: "#products_grid",
57

68
start: function () {
@@ -16,9 +18,8 @@ var WebsiteSaleProductAssortment = {
1618
product_dic[this.querySelector("a img").src.split("/")[6]] = this;
1719
});
1820
const product_ids = Object.keys(product_dic).map(Number);
19-
return this._rpc({
20-
route: "/sale/get_info_assortment_preview",
21-
params: {product_template_ids: product_ids},
21+
return rpc("/sale/get_info_assortment_preview", {
22+
product_template_ids: product_ids,
2223
}).then((product_values) => {
2324
for (const product of product_values) {
2425
this.render_product_assortment(product_dic[product.id], product);
@@ -37,6 +38,4 @@ var WebsiteSaleProductAssortment = {
3738

3839
$(product_info).find(".fa-shopping-cart").parent().addClass("disabled");
3940
},
40-
};
41-
42-
export default WebsiteSaleProductAssortment;
41+
});
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Copyright 2024 Tecnativa - Carlos Roca
2+
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
3+
4+
import {registry} from "@web/core/registry";
5+
6+
registry.category("web_tour.tours").add("test_assortment_with_no_purchase", {
7+
url: "/shop",
8+
test: true,
9+
steps: () => [
10+
{
11+
trigger:
12+
".oe_product_cart:has(.text-danger:has(.fa-exclamation-triangle)) a:contains('Test Product 1')",
13+
run: "click",
14+
},
15+
{
16+
trigger: ".text-danger:has(.fa-exclamation-triangle)",
17+
},
18+
{
19+
trigger: "a#add_to_cart.disabled",
20+
run: "click",
21+
},
22+
{
23+
trigger: "span[name='testing']",
24+
},
25+
{
26+
trigger: "a[href='/shop']",
27+
run: "click",
28+
},
29+
],
30+
});

website_sale_product_assortment/static/src/js/no_purchase_tour.js

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* Copyright 2024 Tecnativa - Carlos Roca
2+
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
3+
4+
import {registry} from "@web/core/registry";
5+
6+
registry.category("web_tour.tours").add("test_assortment_with_no_restriction", {
7+
url: "/shop",
8+
test: true,
9+
steps: () => [
10+
{
11+
trigger: "a:contains('Test Product 1')",
12+
run: "click",
13+
},
14+
{
15+
trigger: "a#add_to_cart",
16+
run: "click",
17+
},
18+
{
19+
trigger: "sup.my_cart_quantity:contains('1')",
20+
},
21+
{
22+
trigger: "a[href='/shop/cart']",
23+
run: "click",
24+
},
25+
{
26+
trigger: "input.js_quantity[value='1']",
27+
},
28+
{
29+
trigger: "a:contains('Test Product 1')",
30+
},
31+
],
32+
});

website_sale_product_assortment/static/src/js/no_restriction_tour.js

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* Copyright 2024 Tecnativa - Carlos Roca
2+
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) */
3+
4+
import {registry} from "@web/core/registry";
5+
6+
registry.category("web_tour.tours").add("test_assortment_with_no_show", {
7+
url: "/shop",
8+
test: true,
9+
steps: () => [
10+
{
11+
trigger:
12+
".o_wsale_product_grid_wrapper:not(:has(a:contains('Test Product 1')))",
13+
},
14+
{
15+
trigger: "a[href='/shop']",
16+
run: "click",
17+
},
18+
],
19+
});

website_sale_product_assortment/static/src/js/no_show_tour.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)