From 998db2c61f157afe0cd750fda970fde60f4aa2b5 Mon Sep 17 00:00:00 2001 From: Gaurav Panchal Date: Tue, 16 Dec 2014 18:13:13 +0530 Subject: [PATCH] [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 --- addons/stock/wizard/stock_return_picking.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py index 8e30fc01bd8..46d523d7546 100644 --- a/addons/stock/wizard/stock_return_picking.py +++ b/addons/stock/wizard/stock_return_picking.py @@ -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)