[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
This commit is contained in:
Nicolas Martinelli 2015-07-31 15:54:02 +02:00
parent 282fc4a850
commit f0cfc7c01e
1 changed files with 4 additions and 0 deletions

View File

@ -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\