From 099b8d7a59a9ba5075b92955701b774f91d57d9d Mon Sep 17 00:00:00 2001 From: David Alonso // Solvos Date: Wed, 8 May 2024 18:14:32 +0200 Subject: [PATCH] [MIG] website_sale_order_type: Migration 17.0 --- website_sale_order_type/__manifest__.py | 4 ++-- .../website_sale_order_type_tour.esm.js} | 23 +++++-------------- .../tests/test_website_sale_order_type.py | 6 +++-- 3 files changed, 12 insertions(+), 21 deletions(-) rename website_sale_order_type/static/src/{js/website_sale_order_type_tour.js => tests/tours/website_sale_order_type_tour.esm.js} (58%) diff --git a/website_sale_order_type/__manifest__.py b/website_sale_order_type/__manifest__.py index 4b836a425e..79a1ab0064 100644 --- a/website_sale_order_type/__manifest__.py +++ b/website_sale_order_type/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Website sale order type", "summary": "This module allows sale_order_type to work with website_sale.", - "version": "16.0.1.0.1", + "version": "17.0.1.0.0", "development_status": "Beta", "category": "Website", "website": "https://github.com/OCA/e-commerce", @@ -14,7 +14,7 @@ "depends": ["website_sale", "sale_order_type"], "assets": { "web.assets_tests": [ - "/website_sale_order_type/static/src/js/website_sale_order_type_tour.js" + "/website_sale_order_type/static/src/tests/tours/website_sale_order_type_tour.esm.js" ] }, "auto_install": True, diff --git a/website_sale_order_type/static/src/js/website_sale_order_type_tour.js b/website_sale_order_type/static/src/tests/tours/website_sale_order_type_tour.esm.js similarity index 58% rename from website_sale_order_type/static/src/js/website_sale_order_type_tour.js rename to website_sale_order_type/static/src/tests/tours/website_sale_order_type_tour.esm.js index fee5cf5f4b..3fed65d4ab 100644 --- a/website_sale_order_type/static/src/js/website_sale_order_type_tour.js +++ b/website_sale_order_type/static/src/tests/tours/website_sale_order_type_tour.esm.js @@ -1,12 +1,12 @@ /* Copyright 2020 Tecnativa - João Marques * License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */ -odoo.define("website_sale_order_type.tour", function (require) { - "use strict"; +import {registry} from "@web/core/registry"; - var tour = require("web_tour.tour"); - - var steps = [ +registry.category("web_tour.tours").add("website_sale_order_type_tour", { + test: true, + url: "/shop", + steps: () => [ { trigger: ".oe_product_cart a:contains('Test Product SO Type')", }, @@ -20,16 +20,5 @@ odoo.define("website_sale_order_type.tour", function (require) { { trigger: ".btn:contains('Process Checkout')", }, - ]; - tour.register( - "website_sale_order_type_tour", - { - url: "/shop", - test: true, - }, - steps - ); - return { - steps: steps, - }; + ], }); diff --git a/website_sale_order_type/tests/test_website_sale_order_type.py b/website_sale_order_type/tests/test_website_sale_order_type.py index c477934d1c..15f82785f3 100644 --- a/website_sale_order_type/tests/test_website_sale_order_type.py +++ b/website_sale_order_type/tests/test_website_sale_order_type.py @@ -6,7 +6,7 @@ @tagged("post_install", "-at_install") class TestFrontend(HttpCase): def setUp(self): - super(TestFrontend, self).setUp() + super().setUp() self.sale_type_model = self.env["sale.order.type"] self.product_template = self.env["product.template"].create( { @@ -33,7 +33,7 @@ def create_sale_type(self): ) self.warehouse = self.env.ref("stock.warehouse0") self.immediate_payment = self.env.ref("account.account_payment_term_immediate") - self.sale_pricelist = self.env.ref("product.list0") + self.sale_pricelist = self.env.ref("website_sale.list_europe") self.free_carrier = self.env.ref("account.incoterm_FCA") return self.sale_type_model.create( { @@ -57,3 +57,5 @@ def test_website_sale_order_type(self): [("id", "not in", existing_orders.ids)] ) self.assertEqual(created_order.type_id, self.sale_type) + self.assertEqual(created_order.payment_term_id, self.sale_type.payment_term_id) + self.assertEqual(created_order.pricelist_id, self.sale_type.pricelist_id)