diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/my_reference.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/my_reference.xml
index 0d6db91b15a38f18de91a7e01d0c0306cef37e6b..c4fa94ca59827b03921d5e12f0d3454ecd6129d7 100755
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/my_reference.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewAccounting/my_reference.xml
@@ -215,7 +215,7 @@
                 </item>
                 <item>
                     <key> <string>editable</string> </key>
-                    <value> <int>1</int> </value>
+                    <value> <int>0</int> </value>
                 </item>
                 <item>
                     <key> <string>editable_expression</string> </key>
diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewInvoice/my_reference.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewInvoice/my_reference.xml
index 0d6db91b15a38f18de91a7e01d0c0306cef37e6b..c4fa94ca59827b03921d5e12f0d3454ecd6129d7 100755
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewInvoice/my_reference.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/SaleInvoiceTransaction_viewInvoice/my_reference.xml
@@ -215,7 +215,7 @@
                 </item>
                 <item>
                     <key> <string>editable</string> </key>
-                    <value> <int>1</int> </value>
+                    <value> <int>0</int> </value>
                 </item>
                 <item>
                     <key> <string>editable_expression</string> </key>
diff --git a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/Delivery_Build.xml b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/Delivery_Build.xml
index a9359e8d451cfd9fff601344ebf3664da28c7db2..3a77c9f657ee4394aee090843060c38a273860a0 100755
--- a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/Delivery_Build.xml
+++ b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/Delivery_Build.xml
@@ -79,15 +79,44 @@ builder_by_ptype = {\n
   \'Pay Sheet Transaction\' :  \'pay_sheet_transaction_builder\',\n
 }\n
 \n
-if builder_by_ptype.has_key(delivery_portal_type) : \n
+if builder_by_ptype.has_key(delivery_portal_type) :\n
   builder = getattr(portal_deliveries, builder_by_ptype[delivery_portal_type], None)\n
   if builder is None :\n
-    context.log(\'accounting_workflow/scripts/Delivery_build\', \n
+    context.log(\'accounting_workflow/scripts/Delivery_build\',\n
                 \'unable to build : no builder in %s\' % builder_by_ptype[delivery_portal_type])\n
     return\n
-  \n
-  # FIXME after_method_id is not enough here. \n
-  \n
+\n
+  ### Kev patch: Generate pay sheet accounting lines (inspired by order_workflow)\n
+  # (It could be great to make this Delivery_build script more generic)\n
+  if delivery_portal_type == \'Pay Sheet Transaction\':\n
+    PRIORITY     = 3\n
+    pay_sheet    = delivery\n
+    previous_tag = pay_sheet.getPath() + \'_firstUpdateAppliedRule\'\n
+    expand_tag   = pay_sheet.getPath() + \'_expand\'\n
+    activate_kw  = { \'tag\'     : expand_tag\n
+                   , \'priority\': PRIORITY\n
+                   }\n
+\n
+    pay_sheet.activate( tag       = expand_tag\n
+                      , after_tag = previous_tag\n
+                      , priority  = PRIORITY\n
+                      ).updateAppliedRule( rule_id     = \'default_invoice_rule\'\n
+                                         , activate_kw = activate_kw\n
+                                         )\n
+\n
+    builder = pay_sheet.portal_deliveries.pay_sheet_transaction_builder\n
+    builder.activate( activity  = \'SQLQueue\'\n
+                    , after_tag = expand_tag\n
+                    , priority  = PRIORITY\n
+                    ).build( explanation_uid = pay_sheet.getUid()\n
+                           , activate_kw     = activate_kw\n
+                           )\n
+    return\n
+  ### End of kev patch\n
+\n
+\n
+  # FIXME after_method_id is not enough here.\n
+\n
   # build accounting lines\n
   builder.activate(\n
       after_method_id=(\'expand\', \'updateAppliedRule\', \'edit\',\'recursiveImmediateReindexObject\', \'immediateReindexObject\'))\\\n
@@ -152,6 +181,11 @@ if builder_by_ptype.has_key(delivery_portal_type) : \n
                             <string>None</string>
                             <string>builder</string>
                             <string>context</string>
+                            <string>PRIORITY</string>
+                            <string>pay_sheet</string>
+                            <string>previous_tag</string>
+                            <string>expand_tag</string>
+                            <string>activate_kw</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml
index bab12f33b13ca901688219108ea9e7e98262ac36..77047f2496ea371a437d9b8ab1c1c80aabcac78a 100755
--- a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml
+++ b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/setReferences.xml
@@ -79,13 +79,16 @@ if transaction.getPortalType() == \'Sale Invoice Transaction\':\n
     invoice_id_group = (\'accounting\', \'invoice\', source_section)\n
     invoice_reference = transaction.generateNewId(id_group = invoice_id_group)\n
     transaction.setReference(invoice_reference)\n
+\n
 # Generate new values for Source Reference and Destination Reference.\n
-source_id_group = (\'accounting\', \'section\', source_section)\n
-source_reference = transaction.generateNewId(id_group = source_id_group)\n
-transaction.setSourceReference(source_reference)\n
-destination_id_group = (\'accounting\', \'section\', destination_section)\n
-destination_reference = transaction.generateNewId(id_group = destination_id_group)\n
-transaction.setDestinationReference(destination_reference)\n
+if transaction.getSourceReference() in (None, \'\'):\n
+  source_id_group = (\'accounting\', \'section\', source_section)\n
+  source_reference = transaction.generateNewId(id_group = source_id_group)\n
+  transaction.setSourceReference(source_reference)\n
+if transaction.getDestinationReference() in (None, \'\'):\n
+  destination_id_group = (\'accounting\', \'section\', destination_section)\n
+  destination_reference = transaction.generateNewId(id_group = destination_id_group)\n
+  transaction.setDestinationReference(destination_reference)\n
 </string> </value>
         </item>
         <item>
diff --git a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/balance_action.xml b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/balance_action.xml
index bebdefc70ceee3e28338579e5821e21f7eca92a6..b3a6a566f9c5e08dc0e5007fba228e83189f22ab 100755
--- a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/balance_action.xml
+++ b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/balance_action.xml
@@ -36,7 +36,7 @@
         </item>
         <item>
             <key> <string>after_script_name</string> </key>
-            <value> <string></string> </value>
+            <value> <string>setReferences</string> </value>
         </item>
         <item>
             <key> <string>description</string> </key>
diff --git a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/confirm.xml b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/confirm.xml
index 6f368f997f681cb780b9ab00958ccbc0b194fbd8..334872e36535fafcfcb201eab26b98cdb2e0cff2 100755
--- a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/confirm.xml
+++ b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/transitions/confirm.xml
@@ -54,7 +54,7 @@
         </item>
         <item>
             <key> <string>script_name</string> </key>
-            <value> <string></string> </value>
+            <value> <string>setReferences</string> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/bt5/erp5_accounting/bt/change_log b/bt5/erp5_accounting/bt/change_log
index a5b5189ed8d1eea61ff62f8a30dceed8a07612df..cb7411c114687b95448ed7561f8e87ac539faa81 100755
--- a/bt5/erp5_accounting/bt/change_log
+++ b/bt5/erp5_accounting/bt/change_log
@@ -1,5 +1,20 @@
+2006-03-07 Kevin
+* Fix setReferences script of accounting_workflow to let the script generate good IDs.
+
+2006-03-02 jerome
+* Reverse source & destination section in Purchase Invoice Transaction views.
+* Improve asset conversion forms to include stat columns and relation fields for source & destination sections.
+
+2006-03-01 Kevin
+* Fix Delivery_Build workflow script.
+* setReference script of accounting workflow can be recalled multiple times on the same object without any side effect.
+* Call setReference script on balance_action and stop action.
+* Don't let the user edit the "Invoice Number" on Sale Invoice Transactions.
+
 2006-02-28 Kevin
 * Update SaleInvoiceTransaction_zSelectMovement to not include a 'AS movement' statement in SQL query.
+* Move setReferences() call on accounting workflow from stop transition after script to confirm transition before script.
+* Update Delivery_build on accounting workflow to generate pay sheet accounting lines automatticaly when they reach the 'confirm' state.
 
 2006-02-27 Kevin
 * Update Section_getCurrencyPrecision (more generic now).