[FIX]stock: return of 'To Be Invoiced' picking should also be invoiced

When creating a return picking, the default invoice state is 'To Be Invoiced' if
returned picking was invoiced. However if the invoice of the picking has not
been generated yet (state '2binvoiced'), the return should also be invoiced.
Fixes #4002
This commit is contained in:
Gaurav Panchal
2014-12-17 11:52:37 +01:00
committed by Martin Trigaux
parent ba70393bc4
commit 998db2c61f
+3 -3
View File
@@ -69,10 +69,10 @@ class stock_return_picking(osv.osv_memory):
pick = pick_obj.browse(cr, uid, record_id, context=context)
if pick:
if 'invoice_state' in fields:
if pick.invoice_state=='invoiced':
res.update({'invoice_state': '2binvoiced'})
if pick.invoice_state in ['invoiced','2binvoiced']:
res['invoice_state'] = '2binvoiced'
else:
res.update({'invoice_state': 'none'})
res['invoice_state'] = 'none'
return_history = self.get_return_history(cr, uid, record_id, context)
for line in pick.move_lines:
qty = line.product_qty - return_history.get(line.id, 0)