lp bug: https://launchpad.net/bugs/552455 fixed
lp bug: https://launchpad.net/bugs/567987 fixed
bzr revid: jvo@tinyerp.com-
20100429153104-ulg4ju5xan1ang8i
# Method overridden to set the analytic account by default on criterion match
def invoice_line_create(self, cr, uid, ids, context={}):
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
+ if not ids:
+ return create_ids
sale_line_obj = self.browse(cr, uid, ids[0], context)
pool_inv_line = self.pool.get('account.invoice.line')
for line in o.order_line:
if (line.state in states) and not line.invoiced:
lines.append(line.id)
- if not lines:
- raise osv.except_osv(_('Warning'),_('Invoice cannot be created for this Sale Order due to one of the following reasons:\n1.The state is not in %s!\n2.The Sale Order Lines are Invoiced!')%(states,))
created_lines = self.pool.get('sale.order.line').invoice_line_create(cr, uid, lines)
if created_lines:
invoices.setdefault(o.partner_id.id, []).append((o, created_lines))