[FIX] Sale: 'Recreate procurement' on shipping exception ignores partial deliveries

lp bug: https://launchpad.net/bugs/674420 fixed

bzr revid: mtr@mtr-20101123134218-qa6lf3us1c1k76zc
This commit is contained in:
mtr
2010-11-23 19:12:18 +05:30
parent de80030a87
commit 6269b4aabe
+11 -2
View File
@@ -671,6 +671,8 @@ class sale_order(osv.osv):
def action_ship_create(self, cr, uid, ids, *args):
wf_service = netsvc.LocalService("workflow")
picking_id = False
move_obj = self.pool.get('stock.move')
proc_obj = self.pool.get('procurement.order')
company = self.pool.get('res.users').browse(cr, uid, uid).company_id
for order in self.browse(cr, uid, ids, context={}):
proc_ids = []
@@ -742,7 +744,13 @@ class sale_order(osv.osv):
})
proc_ids.append(proc_id)
self.pool.get('sale.order.line').write(cr, uid, [line.id], {'procurement_id': proc_id})
if line.state == 'exception':
for pick in order.picking_ids:
for moves in pick.move_lines:
if moves.state == 'cancel':
move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty})
proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty})
val = {}
for proc_id in proc_ids:
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
@@ -752,7 +760,8 @@ class sale_order(osv.osv):
if order.state == 'shipping_except':
val['state'] = 'progress'
val['shipped'] = False
if (order.order_policy == 'manual'):
for line in order.order_line:
if (not line.invoiced) and (line.state not in ('cancel', 'draft')):