[FIX] sale_stock_margin: fix test_so_and_multicurrency failing around midnight
Due to res currency date in user timezone and sale order date in utc. closes odoo/odoo#77283 X-original-commit: 34ce921ee1792dbe498fdab96808f76a5c336323 Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com> Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
This commit is contained in:
@@ -171,12 +171,13 @@ class TestSaleStockMargin(TestStockValuationCommon):
|
||||
company_currency = self.env.company.currency_id
|
||||
other_currency = self.env.ref('base.EUR') if company_currency == self.env.ref('base.USD') else self.env.ref('base.USD')
|
||||
|
||||
ResCurrencyRate.create({'currency_id': company_currency.id, 'rate': 1})
|
||||
other_currency_rate = ResCurrencyRate.search([('name', '=', fields.Date.today()), ('currency_id', '=', other_currency.id)])
|
||||
date = fields.Date.today()
|
||||
ResCurrencyRate.create({'currency_id': company_currency.id, 'rate': 1, 'name': date})
|
||||
other_currency_rate = ResCurrencyRate.search([('name', '=', date), ('currency_id', '=', other_currency.id)])
|
||||
if other_currency_rate:
|
||||
other_currency_rate.rate = 2
|
||||
else:
|
||||
ResCurrencyRate.create({'currency_id': other_currency.id, 'rate': 2})
|
||||
ResCurrencyRate.create({'currency_id': other_currency.id, 'rate': 2, 'name': date})
|
||||
|
||||
so = self._create_sale_order()
|
||||
so.pricelist_id = self.env['product.pricelist'].create({
|
||||
|
||||
Reference in New Issue
Block a user