From 7b494187e99f90359167bb02743bc2f4f5f81043 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 22 Jun 2017 10:47:57 +0200 Subject: [PATCH] [FIX] point_of_sale: make tests consistent wrt taxes After rev d938ba87ae524ab10a1da43471962f10ed53b9ca, taxes that are included in the price are subtracted in case the tax is not applied in an order (e.g. when the fiscal position remove the tax). Some of the test orders did not apply any tax, and because the products used in the test had some tax included, the above revision made the tests fail (by subtracting the tax amount from the price). Fixed by making the test orders more consistent wrt to taxes, applying the taxes as would happen in the UI, then correcting the payment amounts to include the extra tax amounts. --- addons/point_of_sale/tests/test_point_of_sale_flow.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/tests/test_point_of_sale_flow.py b/addons/point_of_sale/tests/test_point_of_sale_flow.py index 7ddf15de08a..d37a19c890e 100644 --- a/addons/point_of_sale/tests/test_point_of_sale_flow.py +++ b/addons/point_of_sale/tests/test_point_of_sale_flow.py @@ -142,12 +142,14 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon): 'price_unit': 450, 'discount': 0.0, 'qty': 2.0, + 'tax_ids': [(6, 0, self.product3.taxes_id.ids)], }), (0, 0, { 'name': "OL/0002", 'product_id': self.product4.id, 'price_unit': 300, 'discount': 0.0, 'qty': 3.0, + 'tax_ids': [(6, 0, self.product4.taxes_id.ids)], })] }) @@ -157,7 +159,7 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon): "active_id": self.pos_order_pos1.id } self.pos_make_payment_2 = self.PosMakePayment.with_context(context_make_payment).create({ - 'amount': 1800 + 'amount': 1845 }) # I click on the validate button to register the payment. @@ -204,12 +206,14 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon): 'price_unit': 450, 'discount': 0.0, 'qty': (-2.0), + 'tax_ids': [(6, 0, self.product3.taxes_id.ids)], }), (0, 0, { 'name': "OL/0004", 'product_id': self.product4.id, 'price_unit': 300, 'discount': 0.0, 'qty': (-3.0), + 'tax_ids': [(6, 0, self.product4.taxes_id.ids)], })] }) @@ -219,7 +223,7 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon): "active_id": self.pos_order_pos2.id } self.pos_make_payment_3 = self.PosMakePayment.with_context(context_make_payment).create({ - 'amount': (-1800) + 'amount': (-1845) }) # I click on the validate button to register the payment.