[FIX] pos_sale, sale: wrong currency stored

- Set the compay currency in USD
- Set the rate of USD to 1.0, the rate of EUR to 2.0
- Create a SO for a product costing 100, validate
- Go to Sales > Reporting > Sales

The product is evaluated at 400.

This is because the currency rate sotred is incorrect. The rate stored
is 0.5 instead of 2.0.

opw-1890778

closes odoo/odoo#27769
This commit is contained in:
Nicolas Martinelli
2018-10-15 08:16:45 +00:00
parent 38f6983df7
commit 42c6db5e01
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -13,4 +13,4 @@ class PosOrder(models.Model):
def _compute_currency_rate(self):
for order in self:
date_order = order.date_order or fields.Datetime.now()
order.currency_rate = self.env['res.currency']._get_conversion_rate(order.pricelist_id.currency_id, order.company_id.currency_id, order.company_id, date_order)
order.currency_rate = self.env['res.currency']._get_conversion_rate(order.company_id.currency_id, order.pricelist_id.currency_id, order.company_id, date_order)
+1 -1
View File
@@ -208,7 +208,7 @@ class SaleOrder(models.Model):
@api.depends('pricelist_id', 'date_order', 'company_id')
def _compute_currency_rate(self):
for order in self:
order.currency_rate = self.env['res.currency']._get_conversion_rate(order.currency_id, order.company_id.currency_id, order.company_id, order.date_order)
order.currency_rate = self.env['res.currency']._get_conversion_rate(order.company_id.currency_id, order.currency_id, order.company_id, order.date_order)
def _compute_access_url(self):
super(SaleOrder, self)._compute_access_url()