[MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 9929 revid:dle@openerp.com...
[odoo/odoo.git] / addons / sale / wizard / sale_make_invoice.py
index 3712fed..1702598 100644 (file)
@@ -55,11 +55,12 @@ class sale_make_invoice(osv.osv_memory):
                 raise osv.except_osv(_('Warning!'), _("You shouldn't manually invoice the following sale order %s") % (sale_order.name))
 
         order_obj.action_invoice_create(cr, uid, context.get(('active_ids'), []), data['grouped'], date_invoice=data['invoice_date'])
-
-        for o in order_obj.browse(cr, uid, context.get(('active_ids'), []), context=context):
+        orders = order_obj.browse(cr, uid, context.get(('active_ids'), []), context=context)
+        for o in orders:
             for i in o.invoice_ids:
                 newinv.append(i.id)
-
+        # Dummy call to workflow, will not create another invoice but bind the new invoice to the subflow
+        order_obj.signal_manual_invoice(cr, uid, [o.id for o in orders if o.order_policy == 'manual'])
         result = mod_obj.get_object_reference(cr, uid, 'account', 'action_invoice_tree1')
         id = result and result[1] or False
         result = act_obj.read(cr, uid, [id], context=context)[0]