Skip to content

Commit

Permalink
[FIX] point_of_sale: make tests consistent wrt taxes
Browse files Browse the repository at this point in the history
After rev d938ba8, 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.
  • Loading branch information
odony committed Jun 22, 2017
1 parent 79dfcde commit 7b49418
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions addons/point_of_sale/tests/test_point_of_sale_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@ def test_order_to_picking(self):
'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)],
})]
})

Expand All @@ -157,7 +159,7 @@ def test_order_to_picking(self):
"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.
Expand Down Expand Up @@ -204,12 +206,14 @@ def test_order_to_picking(self):
'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)],
})]
})

Expand All @@ -219,7 +223,7 @@ def test_order_to_picking(self):
"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.
Expand Down

0 comments on commit 7b49418

Please sign in to comment.