diff options
| author | Josse Colpaert <jco@odoo.com> | 2021-03-12 09:37:49 +0000 |
|---|---|---|
| committer | Josse Colpaert <jco@odoo.com> | 2021-03-12 16:10:27 +0000 |
| commit | f0a1e7c35bd8cd17149d1d54bfe5b9eec12a0814 (patch) | |
| tree | 3544c67cafcb05ef744594bf9085c8a2d1b1668e | |
| parent | bde2be069910596df9433df684309fe9f21a494a (diff) | |
[FIX] delivery: avoid tests to fail with l10n_*
The problem is that the cache still thinks in the test that
it is in EUR and then it does a currency conversion for calculating the
delivery cost and the test will fail in L105 of test_delivery_stock.py
By invalidating the cache after the sql that change the currency of the
company, we solve it.
(someone should refactor those tests though)
closes odoo/odoo#67476
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Josse Colpaert <jco@openerp.com>
| -rw-r--r-- | addons/delivery/tests/test_delivery_cost.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/delivery/tests/test_delivery_cost.py b/addons/delivery/tests/test_delivery_cost.py index d60980419b8..8353abbd7dc 100644 --- a/addons/delivery/tests/test_delivery_cost.py +++ b/addons/delivery/tests/test_delivery_cost.py @@ -44,9 +44,11 @@ class TestDeliveryCost(common.TransactionCase): self.free_delivery = self.env.ref('delivery.free_delivery_carrier') # as the tests hereunder assume all the prices in USD, we must ensure # that the company actually uses USD + # We do an invalidate_cache so the cache is aware of it too. self.env.cr.execute( "UPDATE res_company SET currency_id = %s WHERE id = %s", [self.env.ref('base.USD').id, self.env.company.id]) + self.env.company.invalidate_cache() self.pricelist.currency_id = self.env.ref('base.USD').id def test_00_delivery_cost(self): @@ -102,8 +104,9 @@ class TestDeliveryCost(common.TransactionCase): ('product_id', '=', self.normal_delivery.product_id.id)]) self.assertEqual(len(line), 1, "Delivery cost is not Added") + zin = str(delivery_wizard.display_price) + " " + str(delivery_wizard.delivery_price) + ' ' + line.company_id.country_id.code + line.company_id.name self.assertEqual(float_compare(line.price_subtotal, 10.0, precision_digits=2), 0, - "Delivery cost is not correspond.") + "Delivery cost does not correspond to 10.0. %s %s" % (line.price_subtotal, zin)) # I confirm the sales order |
