[IMP]Sale : improve flow when no product in sale order line and invoice based on delivery at the time invoice is created for that line
bzr revid: mma@tinyerp.com-20121004133241-v4tcf80gwpocbsry
This commit is contained in:
parent
ba97319054
commit
1d2ba2dca3
|
@ -735,13 +735,13 @@ class sale_order_line(osv.osv):
|
|||
if (line.order_id.invoice_quantity=='order'):
|
||||
if line.product_uos:
|
||||
return line.product_uos_qty or 0.0
|
||||
return line.product_uom_qty
|
||||
return line.product_uom_qty
|
||||
|
||||
def _get_line_uom(self, cr, uid, line, context=None):
|
||||
if (line.order_id.invoice_quantity=='order'):
|
||||
if line.product_uos:
|
||||
return line.product_uos.id
|
||||
return line.product_uom.id
|
||||
return line.product_uom.id
|
||||
|
||||
def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None):
|
||||
"""Prepare the dict of values to create the new invoice line for a
|
||||
|
|
|
@ -183,6 +183,16 @@ class stock_picking(osv.osv):
|
|||
'invoiced': True,
|
||||
'invoice_lines': [(6, 0, [invoice_line_id])],
|
||||
})
|
||||
if not sale_line.product_id:
|
||||
vals = order_line_obj._prepare_order_line_invoice_line(cursor, user, sale_line, False, context)
|
||||
if vals:
|
||||
vals['invoice_id'] = invoices[result[picking.id]].id
|
||||
invoice_line_id = invoice_line_obj.create(cursor, user, vals, context=context)
|
||||
order_line_obj.write(cursor, user, [sale_line.id], {
|
||||
'invoiced': True,
|
||||
'invoice_lines': [(6, 0, [invoice_line_id])],
|
||||
})
|
||||
|
||||
return result
|
||||
|
||||
# Redefinition of the new field in order to update the model stock.picking.out in the orm
|
||||
|
|
Loading…
Reference in New Issue