Commit 871b1de4 authored by Jérome Perrin's avatar Jérome Perrin

accounting: fix test_roundDebitCredit_raises_if_big_difference

roundDebitCredit does not raise in case of big difference since
696bc0d2 (2009-02-06 yo * Stop raising an exception, even if the
credit is not equal to the debit in a built delivery, in the post
processing script, because the builder may not blindly adopt prevision
when updating existing lines, thus it can be unbalanced., 2009-02-06)

This assertRaises syntax does nothing on python2 and was an error on
python2. Update the test to test the actual behavior
parent 52ac7372
...@@ -4322,7 +4322,7 @@ class TestTransactions(AccountingTestCase): ...@@ -4322,7 +4322,7 @@ class TestTransactions(AccountingTestCase):
self.assertFalse(invoice_line.getGroupingReference()) self.assertFalse(invoice_line.getGroupingReference())
self.assertFalse(payment_line.getGroupingReference()) self.assertFalse(payment_line.getGroupingReference())
def test_roundDebitCredit_raises_if_big_difference(self): def test_roundDebitCredit_does_nothing_if_big_difference(self):
invoice = self._makeOne( invoice = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
lines=(dict(source_value=self.account_module.goods_sales, lines=(dict(source_value=self.account_module.goods_sales,
...@@ -4330,7 +4330,11 @@ class TestTransactions(AccountingTestCase): ...@@ -4330,7 +4330,11 @@ class TestTransactions(AccountingTestCase):
dict(source_value=self.account_module.receivable, dict(source_value=self.account_module.receivable,
source_credit=100.000001))) source_credit=100.000001)))
invoice.newContent(portal_type='Invoice Line', quantity=1, price=100) invoice.newContent(portal_type='Invoice Line', quantity=1, price=100)
self.assertRaises(invoice.AccountingTransaction_roundDebitCredit) self.assertEqual(
sorted([
m.getQuantity() for m in invoice.getMovementList(
portal_type='Sale Invoice Transaction Line')]),
[-100.032345, 100.000001])
def test_roundDebitCredit_when_payable_is_different_total_price(self): def test_roundDebitCredit_when_payable_is_different_total_price(self):
invoice = self._makeOne( invoice = self._makeOne(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment