diff --git a/addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js b/addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js index eac499812d28162bd5738b2b2a512479365949d6..c44eb4cb2cff93b8014b85f3a60719195538e2c5 100644 --- a/addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js @@ -230,7 +230,6 @@ odoo.define('point_of_sale.TicketScreen', function (require) { }); return; } - destinationOrder.fiscal_position = order.fiscal_position; // Add orderline for each toRefundDetail to the destinationOrder. for (const refundDetail of allToRefundDetails) { @@ -239,6 +238,7 @@ odoo.define('point_of_sale.TicketScreen', function (require) { await destinationOrder.add_product(product, options); refundDetail.destinationOrderUid = destinationOrder.uid; } + destinationOrder.fiscal_position = order.fiscal_position; // Set the partner to the destinationOrder. if (partner && !destinationOrder.get_partner()) { 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 ac36c73ac8378e521ddf71a1daae5dd2a6dabe63..ab0111fcbc78b78a834b23d374d9684205c5f9b3 100644 --- a/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js @@ -139,4 +139,29 @@ odoo.define('point_of_sale.tour.TicketScreen', function (require) { TicketScreen.check.refundedNoteContains('2.00 Refunded'); Tour.register('TicketScreenTour', { test: true, url: '/pos/ui' }, getSteps()); + + 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'); + TicketScreen.do.clickOrderline('Product Test'); + TicketScreen.do.pressNumpad('1'); + TicketScreen.check.toRefundTextContains('To Refund: 1.00'); + TicketScreen.do.confirmRefund(); + ProductScreen.check.isShown(); + ProductScreen.check.totalAmountIs('-86.96'); + + Tour.register('FiscalPositionNoTaxRefund', { test: true, url: '/pos/ui' }, getSteps()); }); diff --git a/addons/point_of_sale/tests/test_frontend.py b/addons/point_of_sale/tests/test_frontend.py index 3d95370c8735410a82eb7bb4fce3d7fd246a276a..fcda8dba1bacbd31455df67f8fbef4a7a2bb56fe 100644 --- a/addons/point_of_sale/tests/test_frontend.py +++ b/addons/point_of_sale/tests/test_frontend.py @@ -922,3 +922,46 @@ class TestUi(TestPointOfSaleHttpCommon): self.main_pos_config.open_ui() self.start_tour("/pos/ui?debug=1&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")