[FIX] purchase_requisition: Fix failing test

During the test, the rate are created on UTC timezone.
However the test could be run with a different timezone.

Since the rate doens't have a name, by default they have the
create date name. However due to timezone difference, it could
be different day and the newly created rate for the test will be
filter out

closes odoo/odoo#131708

X-original-commit: 300fe8ad36163b6ad7f8a37ac26b014c1510d64f
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
Arnold Moyaux
2023-08-11 15:53:04 +02:00
parent 62e53fa7b1
commit 9f6ea16943
@@ -2,7 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.purchase_requisition.tests.common import TestPurchaseRequisitionCommon
from odoo import Command
from odoo import Command, fields
from odoo.tests import Form
from datetime import timedelta
@@ -351,16 +351,16 @@ class TestPurchaseRequisition(TestPurchaseRequisitionCommon):
def test_12_alternative_po_line_different_currency(self):
""" Check alternative PO with different currency is compared correctly"""
currency_eur = self.env.ref("base.EUR")
currency_usd = self.env.ref("base.USD")
(currency_usd | currency_eur).active = True
# 1 USD = 0.5 EUR
self.env['res.currency.rate'].create([{
'name': fields.Datetime.today(),
'currency_id': self.env.ref('base.USD').id,
'rate': 1,
}, {
'name': fields.Datetime.today(),
'currency_id': self.env.ref('base.EUR').id,
'rate': 0.5,
}])