-
-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Migrate bs4 to bs5 - Fix shipping address choice functionality - Add tour for the user portal workflow
- Loading branch information
1 parent
54e08e8
commit 4c6dbd2
Showing
7 changed files
with
189 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
rma_sale/static/src/tests/test_rma_sale_portal_tour.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** @odoo-module */ | ||
/* Copyright 2021 Tecnativa - David Vidal | ||
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). */ | ||
|
||
import tour from "web_tour.tour"; | ||
|
||
tour.register( | ||
"rma_sale_portal", | ||
{ | ||
test: true, | ||
url: "/my/orders", | ||
}, | ||
[ | ||
{ | ||
content: "Open the test sale order", | ||
trigger: 'a:containsExact("Test Sale RMA SO")', | ||
}, | ||
{ | ||
content: "Open the RMA request pop-up", | ||
trigger: 'a:contains("Request RMAs")', | ||
}, | ||
{ | ||
content: | ||
"Submit button is disabled until we set quanity and requested operation", | ||
trigger: "button[type='submit'][disabled]", | ||
}, | ||
{ | ||
content: "Return 1 unit for the first row", | ||
trigger: "input[name='0-quantity']", | ||
run: "text 1", | ||
}, | ||
{ | ||
content: "Select the operation", | ||
trigger: "select[name='0-operation_id']", | ||
run: "text Replace", | ||
}, | ||
{ | ||
content: "Write some comments", | ||
trigger: "textarea[name='0-description']", | ||
run: "text I'd like to change this product", | ||
}, | ||
{ | ||
content: "Unfold the Delivery Address picker", | ||
trigger: "button:contains('Choose a delivery address')", | ||
}, | ||
{ | ||
content: "Choose another address", | ||
trigger: ".o_rma_portal_shipping_card:contains('Another address')", | ||
run: "click", | ||
}, | ||
{ | ||
content: "Submit the RMA", | ||
trigger: "button[type='submit']", | ||
}, | ||
{ | ||
content: "We're redirected to the new draft RMA", | ||
trigger: "h5:contains('RMA Order')", | ||
}, | ||
{ | ||
content: "We're redirected to the new draft RMA", | ||
trigger: "h5:contains('RMA Order')", | ||
}, | ||
] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import test_rma_sale | ||
from . import test_rma_sale_portal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright 2023 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from markupsafe import Markup | ||
|
||
from odoo import Command | ||
from odoo.tests import HttpCase, tagged | ||
|
||
from .test_rma_sale import TestRmaSaleBase | ||
|
||
|
||
@tagged("-at-install", "post-install") | ||
class TestRmaSalePortal(TestRmaSaleBase, HttpCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.sale_order = cls._create_sale_order(cls, [[cls.product_1, 5]]) | ||
# So we can click it in the tour | ||
cls.sale_order.name = "Test Sale RMA SO" | ||
cls.sale_order.action_confirm() | ||
# Maybe other modules create additional lines in the create | ||
# method in sale.order model, so let's find the correct line. | ||
cls.order_line = cls.sale_order.order_line.filtered( | ||
lambda r: r.product_id == cls.product_1 | ||
) | ||
cls.order_out_picking = cls.sale_order.picking_ids | ||
cls.order_out_picking.move_ids.quantity_done = 5 | ||
cls.order_out_picking.button_validate() | ||
# Let's create some companion contacts | ||
cls.partner_company = cls.res_partner.create( | ||
{"name": "Partner test Co", "email": "[email protected]"} | ||
) | ||
cls.another_partner = cls.res_partner.create( | ||
{ | ||
"name": "Another address", | ||
"email": "[email protected]", | ||
"parent_id": cls.partner_company.id, | ||
} | ||
) | ||
cls.partner.parent_id = cls.partner_company | ||
# Create our portal user | ||
cls.user_portal = ( | ||
cls.env["res.users"] | ||
.with_context(no_reset_password=True) | ||
.create( | ||
{ | ||
"login": "rma_portal", | ||
"password": "rma_portal", | ||
"partner_id": cls.partner.id, | ||
"groups_id": [Command.set([cls.env.ref("base.group_portal").id])], | ||
} | ||
) | ||
) | ||
|
||
def test_rma_sale_portal(self): | ||
self.start_tour("/", "rma_sale_portal", login="rma_portal") | ||
rma = self.sale_order.rma_ids | ||
# Check that the portal values are properly transmited | ||
self.assertEqual(rma.state, "draft") | ||
self.assertEqual(rma.partner_id, self.partner) | ||
self.assertEqual(rma.partner_shipping_id, self.another_partner) | ||
self.assertEqual(rma.product_uom_qty, 1) | ||
self.assertEqual( | ||
rma.description, Markup("<p>I'd like to change this product</p>") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters