From 5d932e5db164fe80fd7c011ddd53f3494ef89ef5 Mon Sep 17 00:00:00 2001 From: "Julien (juc) Castiaux" Date: Tue, 23 Oct 2018 14:31:31 +0200 Subject: [PATCH] [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 --- addons/delivery/models/sale_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/delivery/models/sale_order.py b/addons/delivery/models/sale_order.py index 4ee66daee85..601f104ff3c 100644 --- a/addons/delivery/models/sale_order.py +++ b/addons/delivery/models/sale_order.py @@ -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):