From 447cf0e2b32f384ff209bb66608260b294106dd8 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Thu, 12 Jan 2012 17:28:34 +0530 Subject: [PATCH 1/2] [IMP]mrp_repair: pass a workflow in make invoice wizard bzr revid: mma@tinyerp.com-20120112115834-8gma20bjj0bbf64h --- addons/mrp_repair/wizard/make_invoice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp_repair/wizard/make_invoice.py b/addons/mrp_repair/wizard/make_invoice.py index 61f82a3d57c..6b49aab5aba 100644 --- a/addons/mrp_repair/wizard/make_invoice.py +++ b/addons/mrp_repair/wizard/make_invoice.py @@ -45,6 +45,8 @@ class make_invoice(osv.osv_memory): order_obj = self.pool.get('mrp.repair') newinv = order_obj.action_invoice_create(cr, uid, context['active_ids'], group=inv.group,context=context) + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'mrp.repair', context.get('active_id'), 'action_invoice_create' , cr) return { 'domain': [('id','in', newinv.values())], From 37c632824af56a92ce39a907206165aea0a37a33 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 24 Jan 2012 15:42:30 +0100 Subject: [PATCH 2/2] [IMP] mrp_repair: add documentation in wizard, and fix a potential bug bzr revid: rco@openerp.com-20120124144230-hkc497if0wdve2r9 --- addons/mrp_repair/wizard/make_invoice.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/mrp_repair/wizard/make_invoice.py b/addons/mrp_repair/wizard/make_invoice.py index 6b49aab5aba..4f0ec8f4b32 100644 --- a/addons/mrp_repair/wizard/make_invoice.py +++ b/addons/mrp_repair/wizard/make_invoice.py @@ -45,8 +45,13 @@ class make_invoice(osv.osv_memory): order_obj = self.pool.get('mrp.repair') newinv = order_obj.action_invoice_create(cr, uid, context['active_ids'], group=inv.group,context=context) + + # We have to trigger the workflow of the given repairs, otherwise they remain 'to be invoiced'. + # Note that the signal 'action_invoice_create' will trigger another call to the method 'action_invoice_create', + # but that second call will not do anything, since the repairs are already invoiced. wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'mrp.repair', context.get('active_id'), 'action_invoice_create' , cr) + for repair_id in context['active_ids']: + wf_service.trg_validate(uid, 'mrp.repair', repair_id, 'action_invoice_create', cr) return { 'domain': [('id','in', newinv.values())],