417
417
for line in o.order_line:
418
418
if (line.state in states) and not line.invoiced:
421
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,))
422
420
created_lines = self.pool.get('sale.order.line').invoice_line_create(cr, uid, lines)
424
422
invoices.setdefault(o.partner_id.id, []).append((o, created_lines))