From be4a9f98c0060b4c08b24590483acf5c11962bc3 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Thu, 1 Feb 2007 04:32:37 +0000
Subject: [PATCH] Modified to generate invoices only when the erp5_accounting
 is installed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12495 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../scripts/PackingList_buildInvoice.xml      | 27 ++++++++++---------
 bt5/erp5_project/bt/revision                  |  2 +-
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/PackingList_buildInvoice.xml b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/PackingList_buildInvoice.xml
index f01605919b..93f96e06f2 100644
--- a/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/PackingList_buildInvoice.xml
+++ b/bt5/erp5_project/WorkflowTemplateItem/portal_workflow/task_report_workflow/scripts/PackingList_buildInvoice.xml
@@ -68,23 +68,23 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>LOG=lambda msg:context.log("PackingList_buildInvoice", msg)\n
-LOG=lambda msg:\'DISABLED\'\n
+            <value> <string>LOG=lambda msg:context.log("TaskReport_buildInvoice", msg)\n
 \n
 packing_list = sci.object\n
 delivery_tool = sci.getPortal().portal_deliveries\n
-LOG("packing_list : %s"%packing_list.getPath())\n
+LOG("Task Report : %s"%packing_list.getPath())\n
 \n
-if hasattr(delivery_tool, \'task_invoice_builder\') :\n
-  delivery_tool.task_invoice_builder.activate(\n
-        after_method_id = [ \'expand\', \n
-                            \'recursiveImmediateReindexObject\',\n
-                            \'immediateReindexObject\' ],\n
-        ).build()\n
-else :\n
-  packing_list.log("ERP5 Simulation",\n
-              "Unable to build Invoice from packing list at %s "\\\n
-              ": no sale_invoice_builder" % packing_list.getPath())\n
+if sci.getPortal().getDefaultModule(\'Accounting Module\') is not None:\n
+  if hasattr(delivery_tool, \'task_invoice_builder\'):\n
+    delivery_tool.task_invoice_builder.activate(\n
+          after_method_id = [ \'expand\', \n
+                              \'recursiveImmediateReindexObject\',\n
+                              \'immediateReindexObject\' ],\n
+          ).build()\n
+  else :\n
+    packing_list.log("ERP5 Simulation",\n
+                "Unable to build Invoice from Task Report at %s "\\\n
+                ": no task_invoice_builder" % packing_list.getPath())\n
 </string> </value>
         </item>
         <item>
@@ -132,6 +132,7 @@ else :\n
                             <string>_getattr_</string>
                             <string>packing_list</string>
                             <string>delivery_tool</string>
+                            <string>None</string>
                             <string>hasattr</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_project/bt/revision b/bt5/erp5_project/bt/revision
index 252b382b33..cbd6012bc6 100644
--- a/bt5/erp5_project/bt/revision
+++ b/bt5/erp5_project/bt/revision
@@ -1 +1 @@
-202
\ No newline at end of file
+204
\ No newline at end of file
-- 
2.30.9