[FIX] point_of_sale: make sure FP is not applied twice on refund
current behavior: When a product with tax included is sold with a fiscal position that match the tax to a tax of 0%, then when you refund this order the fiscal is applied a second time. This result in the 15% tax removed 2 times and the price of the product is incorrect. steps to reproduce: - Create a product with 15% tax included - Create a fiscal position that match the tax to a tax of 0% - Create a POS with this fiscal position - Open PoS, and make an order with the product - Applyy the fiscal position - Refund the order - The price of the product is not the same as the one of the original order. opw-3371028 closes odoo/odoo#136348 X-original-commit: 58406515233234ac0ed342d81a5c55886c3b5712 Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com> Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user