[FIX] delivery: add the delivery after all order lines in SO

The delivery line in the SO was added among other lines,
in second most of the time, due to the fact
the sequence of the line was set after
all other order lines sequences.

opw-649629
This commit is contained in:
Denis Ledoux 2015-09-17 12:45:14 +02:00
parent a11a490d30
commit 90dfaa7add
1 changed files with 6 additions and 4 deletions

View File

@ -84,8 +84,7 @@ class sale_order(osv.Model):
if order.company_id.currency_id.id != order.pricelist_id.currency_id.id:
price_unit = currency_obj.compute(cr, uid, order.company_id.currency_id.id, order.pricelist_id.currency_id.id,
price_unit, context=dict(context or {}, date=order.date_order))
#create the sale order line
line_id = line_obj.create(cr, uid, {
values = {
'order_id': order.id,
'name': grid.carrier_id.name,
'product_uom_qty': 1,
@ -93,7 +92,10 @@ class sale_order(osv.Model):
'product_id': grid.carrier_id.product_id.id,
'price_unit': price_unit,
'tax_id': [(6, 0, taxes_ids)],
'is_delivery': True
}, context=context)
'is_delivery': True,
}
if order.order_line:
values['sequence'] = order.order_line[-1].sequence + 1
line_id = line_obj.create(cr, uid, values, context=context)
line_ids.append(line_id)
return line_ids