[FIX] delivery: wrong currency conversion

In a multi-currency company, the delivery price of a quotation was
wrongly converted when the currency used by the pricelist was not
the same as the currency used by the company.

This PR correct that behavior by correcly compute the delivery
price according to the pricelist currency.

To reproduce:
1) Install the accounting, sales and delivery modules
2) Set the company as a multi-currency company in the accounting
   settings
3) Change the currency rate so the one used by the company is 1
   and the other one (the one that will be used on the pricelist)
   is anything else than 1
4) Create a pricelist with that other currency
5) Create a quotation using the new pricelist, select a deliver
6) Click "Set Price", the delivery price shown on the form isn't
   the same as the price on the quotation.

opw-1894422
This commit is contained in:
Julien (juc) Castiaux
2018-10-24 11:55:32 +02:00
committed by Nicolas Martinelli
parent c0e35f84e2
commit 5d932e5db1
+2 -1
View File
@@ -23,7 +23,8 @@ class SaleOrder(models.Model):
# Prevent SOAP call to external shipping provider when SO has no lines yet
continue
else:
order.delivery_price = order.carrier_id.with_context(order_id=order.id).price
order.delivery_price = order.company_id.currency_id.with_context(date=order.date_order).compute(
order.carrier_id.with_context(order_id=order.id).price, order.pricelist_id.currency_id)
@api.onchange('partner_id')
def onchange_partner_id_dtype(self):