[FIX] stock_invoice_directly: if picking is not done while doing partial picking, create invoice on this backorder instead of the current picking

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

bzr revid: mat@openerp.com-20131023151342-328egar30upq5d5u
This commit is contained in:
Martin Trigaux 2013-10-23 17:13:42 +02:00
commit 20b9015339
1 changed files with 7 additions and 2 deletions

View File

@ -31,9 +31,14 @@ class invoice_directly(osv.osv_memory):
if context is None: context = {}
result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
partial = self.browse(cr, uid, ids[0], context)
if partial.picking_id.state != 'done' and partial.picking_id.backorder_id:
# delivery is not finished, opening invoice on backorder
picking = partial.picking_id.backorder_id
else:
picking = partial.picking_id
context.update(active_model='stock.picking',
active_ids=[partial.picking_id.id])
if partial.picking_id.invoice_state == '2binvoiced':
active_ids=[picking.id])
if picking.invoice_state == '2binvoiced':
return {
'name': 'Create Invoice',
'view_type': 'form',