From f0cfc7c01eabd627567fd212e963d9d7809716aa Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 31 Jul 2015 15:54:02 +0200 Subject: [PATCH] [FIX] delivery: price_unit converted in the invoice currency When the invoice is created from the picking, the delivery charges needs to be converted into the invoice currency. Indeed, there is no currency on a delivery pricelist. opw-646148 --- addons/delivery/stock.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/delivery/stock.py b/addons/delivery/stock.py index f26b44d02c5..9405f1e027f 100644 --- a/addons/delivery/stock.py +++ b/addons/delivery/stock.py @@ -81,6 +81,7 @@ class stock_picking(osv.osv): """ carrier_obj = self.pool.get('delivery.carrier') grid_obj = self.pool.get('delivery.grid') + currency_obj = self.pool.get('res.currency') if not picking.carrier_id or \ any(inv_line.product_id.id == picking.carrier_id.product_id.id for inv_line in invoice.invoice_line): @@ -96,6 +97,9 @@ class stock_picking(osv.osv): price = grid_obj.get_price_from_picking(cr, uid, grid_id, invoice.amount_untaxed, picking.weight, picking.volume, quantity, context=context) + if invoice.company_id.currency_id.id != invoice.currency_id.id: + price = currency_obj.compute(cr, uid, invoice.company_id.currency_id.id, invoice.currency_id.id, + price, context=dict(context or {}, date=invoice.date_invoice)) account_id = picking.carrier_id.product_id.property_account_income.id if not account_id: account_id = picking.carrier_id.product_id.categ_id\