summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorOlivier Colson <oco@odoo.com>2018-06-07 09:56:42 +0200
committerOlivier Colson <oco@odoo.com>2018-06-07 10:01:17 +0200
commitc00df146547dca9c4dea6f39c1f0408ac84ec2d7 (patch)
treea32465b32f7d2d91135f38bdab39011dac34e173 /addons
parent969eb3fa2f9fe78e3f01a6d4caca1aeae753c58c (diff)
[FIX] purchase: anglosaxon reconciliation test: delete rate demo data at the beginning of the test
This is mandatory to ensure consistency of the data generated by the test, as stock pickings created from a PO are by design always created for the current date (there is no way forcing this), meaning that they always use today's exchange rate for their valuation. Despite the fact we rewrite the date of the valuation moves artificially, we cannot correct the debit and credit values, since the anglosaxon entries get automatically reconciled (and you cannot modify a reconciled entry). So, we have to make sure that "today"'s rate will always be the last rate we created in order to ensure complete control of the test. This deletion will have no further impact, as the transaction will be rollbacked at the end of the test.
Diffstat (limited to 'addons')
-rw-r--r--addons/purchase/tests/test_anglo_saxon_valuation_reconciliation.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/purchase/tests/test_anglo_saxon_valuation_reconciliation.py b/addons/purchase/tests/test_anglo_saxon_valuation_reconciliation.py
index fea9c9e38d0..6443d2bf9ea 100644
--- a/addons/purchase/tests/test_anglo_saxon_valuation_reconciliation.py
+++ b/addons/purchase/tests/test_anglo_saxon_valuation_reconciliation.py
@@ -78,6 +78,19 @@ class TestValuationReconciliation(ValuationReconciliationTestCase):
def test_invoice_shipment(self):
""" Tests the case into which we make the invoice first, and then receive the goods.
"""
+ # First, we delete the currency rate defined in demo data for USD on June 6th.
+ # This is mandatory to ensure consistency of the data generated by the test,
+ # as stock pickings created from a PO are by design always created for
+ # the current date (there is no way forcing this), meaning that they
+ # always use today's exchange rate for their valuation.
+ # Despite the fact we rewrite the date of the valuation moves artificially,
+ # we cannot correct the debit and credit values, since the anglosaxon
+ # entries get automatically reconciled (and you cannot modify a reconciled entry).
+ # So, we have to make sure that "today"'s rate will always be the last rate we
+ # created in order to ensure complete control of the test.
+ self.env.ref('base.rateUSDbis').unlink()
+
+
# Create a PO and an invoice for it
test_product = self.test_product_order
purchase_order = self._create_purchase(test_product)