diff --git a/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js b/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js index 8eda3566583..bce673b4dbd 100644 --- a/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js @@ -175,3 +175,35 @@ registry.category("web_tour.tours").add("TicketScreenTour", { return getSteps(); }, }); + + +registry.category("web_tour.tours").add("FiscalPositionNoTaxRefund", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.do.clickDisplayedProduct('Product Test'); + ProductScreen.check.totalAmountIs('100.00'); + ProductScreen.do.changeFiscalPosition('No Tax'); + ProductScreen.check.totalAmountIs('86.96'); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod('Bank'); + PaymentScreen.check.remainingIs('0.00'); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + ReceiptScreen.do.clickNextOrder(); + ProductScreen.do.clickRefund(); + TicketScreen.do.selectOrder('-0001'); + ProductScreen.do.pressNumpad('1'); + TicketScreen.check.toRefundTextContains('To Refund: 1.00'); + TicketScreen.do.confirmRefund(); + ProductScreen.check.isShown(); + ProductScreen.do.goBackToMainScreen(); + ProductScreen.check.totalAmountIs('-86.96'); + + return getSteps(); + } +}); diff --git a/addons/point_of_sale/tests/test_frontend.py b/addons/point_of_sale/tests/test_frontend.py index bc23496c3e0..911d72d8b08 100644 --- a/addons/point_of_sale/tests/test_frontend.py +++ b/addons/point_of_sale/tests/test_frontend.py @@ -975,6 +975,49 @@ class TestUi(TestPointOfSaleHttpCommon): self.main_pos_config.open_ui() self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'GS1BarcodeScanningTour', login="accountman") + def test_refund_order_with_fp_tax_included(self): + #create a tax of 15% tax included + self.tax1 = self.env['account.tax'].create({ + 'name': 'Tax 1', + 'amount': 15, + 'amount_type': 'percent', + 'type_tax_use': 'sale', + 'price_include': True, + }) + #create a tax of 0% + self.tax2 = self.env['account.tax'].create({ + 'name': 'Tax 2', + 'amount': 0, + 'amount_type': 'percent', + 'type_tax_use': 'sale', + }) + #create a fiscal position with the two taxes + self.fiscal_position = self.env['account.fiscal.position'].create({ + 'name': 'No Tax', + 'tax_ids': [(0, 0, { + 'tax_src_id': self.tax1.id, + 'tax_dest_id': self.tax2.id, + })], + }) + + self.product_test = self.env['product.product'].create({ + 'name': 'Product Test', + 'type': 'product', + 'available_in_pos': True, + 'list_price': 100, + 'taxes_id': [(6, 0, self.tax1.ids)], + 'categ_id': self.env.ref('product.product_category_all').id, + }) + + #add the fiscal position to the PoS + self.main_pos_config.write({ + 'fiscal_position_ids': [(4, self.fiscal_position.id)], + 'tax_regime_selection': True, + }) + + self.main_pos_config.open_ui() + self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'FiscalPositionNoTaxRefund', login="accountman") + # This class just runs the same tests as above but with mobile emulation class MobileTestUi(TestUi): browser_size = '375x667'