[FIX]delivery: price of a delivery method not correct

get_price must check the total_amount price without the delivery amount
to compute the delivery prices.

opw:629233
This commit is contained in:
Goffin Simon 2015-03-09 13:57:52 +01:00
parent 0f943ef736
commit fddab4c20d
1 changed files with 4 additions and 1 deletions

View File

@ -208,15 +208,18 @@ class delivery_grid(osv.osv):
weight = 0
volume = 0
quantity = 0
total_delivery = 0.0
product_uom_obj = self.pool.get('product.uom')
for line in order.order_line:
if line.is_delivery:
total_delivery += line.price_subtotal + self.pool['sale.order']._amount_line_tax(cr, uid, line, context=context)
if not line.product_id or line.is_delivery:
continue
q = product_uom_obj._compute_qty(cr, uid, line.product_uom.id, line.product_uom_qty, line.product_id.uom_id.id)
weight += (line.product_id.weight or 0.0) * q
volume += (line.product_id.volume or 0.0) * q
quantity += q
total = order.amount_total or 0.0
total = (order.amount_total or 0.0) - total_delivery
return self.get_price_from_picking(cr, uid, id, total,weight, volume, quantity, context=context)