From b16b33a27fc11b0a68579486476de92a1a489a4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Sat, 29 Nov 2008 10:45:07 +0000
Subject: [PATCH] activate the second script after invoice tax builder
 operation, otherwise a new applied rule might be created for the new created
 invoice

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24750 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../InvoiceTransaction_postGeneration.xml       | 17 ++++++++++++++---
 bt5/erp5_invoicing/bt/revision                  |  2 +-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceTransaction_postGeneration.xml b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceTransaction_postGeneration.xml
index c1f6cab115..9d5a812fab 100644
--- a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceTransaction_postGeneration.xml
+++ b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceTransaction_postGeneration.xml
@@ -62,15 +62,23 @@
 if related_simulation_movement_path_list is None:\n
   raise RuntimeError, \'related_simulation_movement_path_list is missing. Update ERP5 Product.\'\n
 \n
+activate_kw = dict(\n
+      after_path_and_method_id=(related_simulation_movement_path_list,\n
+                                  (\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),)\n
+\n
 invoice = context\n
 packing_list = invoice.getCausalityValue()\n
 if packing_list is not None:\n
   order = packing_list.getCausalityValue()\n
   if order is not None:\n
     invoice.setSpecialise(order.getSpecialise())\n
-  \n
-invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
-  (\'immediateReindexObject\',\'recursiveImmediateReindexObject\'))).InvoiceTransaction_postGenerationActivity(related_simulation_movement_path_list=related_simulation_movement_path_list, **kw)\n
+  # this is tax tag from packing_list_workflow scripts\n
+  activate_kw[\'after_tag\'] = \'build_invoice_tax_%s\' % packing_list.getRelativeUrl()\n
+\n
+invoice.activate(\n
+        **activate_kw\n
+        ).InvoiceTransaction_postGenerationActivity(\n
+                          related_simulation_movement_path_list=related_simulation_movement_path_list, **kw)\n
 </string> </value>
         </item>
         <item>
@@ -111,11 +119,14 @@ invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list
                             <string>kw</string>
                             <string>None</string>
                             <string>RuntimeError</string>
+                            <string>dict</string>
+                            <string>activate_kw</string>
                             <string>context</string>
                             <string>invoice</string>
                             <string>_getattr_</string>
                             <string>packing_list</string>
                             <string>order</string>
+                            <string>_write_</string>
                             <string>_apply_</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_invoicing/bt/revision b/bt5/erp5_invoicing/bt/revision
index 09df927592..a3090d211b 100644
--- a/bt5/erp5_invoicing/bt/revision
+++ b/bt5/erp5_invoicing/bt/revision
@@ -1 +1 @@
-166
\ No newline at end of file
+168
\ No newline at end of file
-- 
2.30.9