From 556914a15dd1ce7af76046fd53f87852cb8e5e6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 19 Dec 2005 09:02:45 +0000
Subject: [PATCH] added script

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4744 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...gTransaction_createReversalTransaction.xml | 224 ++++++++++++++++++
 1 file changed, 224 insertions(+)
 create mode 100755 bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_createReversalTransaction.xml

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_createReversalTransaction.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_createReversalTransaction.xml
new file mode 100755
index 0000000000..f0b877aecf
--- /dev/null
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransaction_createReversalTransaction.xml
@@ -0,0 +1,224 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value> <string encoding="base64">O/INCg==</string> </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>""" Create a reversal transaction from current tansaction. """\n
+\n
+N_ = context.Base_TranslateString\n
+\n
+\n
+\n
+accounting_module = context.getPortalObject().accounting_module\n
+reversal = accounting_module.newContent (\n
+  portal_type = \'Accounting Transaction\',\n
+  source_section = context.getSourceSection(), \n
+  destination_section = context.getDestinationSection(),\n
+  source_payment = context.getSourcePayment(),\n
+  stop_date = context.getStopDate(),\n
+  start_date = context.getStartDate(),\n
+  title = N_("Reversal Transaction for ${title}",\n
+                                      mapping={\'title\' : unicode(context.getTitle(), \'utf8\')}),\n
+  description = N_("Reversal Transaction for ${title} (${source_reference})",\n
+                                      mapping={\'title\' : unicode(context.getTitle(), \'utf8\'), \n
+                                                         \'source_reference\' : context.getSourceReference()}),\n
+  resource = context.getResource(), \n
+  reference = context.getReference(),\n
+  bypass_init_script = 1\n
+)\n
+\n
+for line in context.objectValues(portal_type = context.getPortalAccountingMovementTypeList()) : \n
+  reversal.newContent(\n
+    id = line.getId(),\n
+    portal_type = line.getPortalType(),\n
+    source = line.getSource(),\n
+    destination = line.getDestination(),\n
+    destination_section = line.getDestinationSection(),\n
+    source_payment = line.getSourcePayment(),\n
+    quantity = - line.getQuantity()\n
+  )\n
+\n
+return context.REQUEST.RESPONSE.redirect("%s/view?portal_status_message=%s" %\n
+              (reversal.getPath(),\n
+               N_("Reversal Transaction for ${source_reference} created.",\n
+                       mapping={\'source_reference\' : context.getSourceReference()})))\n
+</string> </value>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kaXJlY3RzIAAAACVzL3ZpZXc/cG9ydGFsX3N0YXR1c19tZXNzYWdlPSVz
+cwcAAABnZXRQYXRoczUAAABSZXZlcnNhbCBUcmFuc2FjdGlvbiBmb3IgJHtzb3VyY2VfcmVmZXJl
+bmNlfSBjcmVhdGVkLigIAAAAcwkAAABfZ2V0YXR0cl9zBwAAAGNvbnRleHRzAgAAAE5fcxEAAABh
+Y2NvdW50aW5nX21vZHVsZXMHAAAAdW5pY29kZXMIAAAAcmV2ZXJzYWxzCQAAAF9nZXRpdGVyX3ME
+AAAAbGluZSgIAAAAcwkAAABfZ2V0YXR0cl9zBwAAAGNvbnRleHRzAgAAAE5fcxEAAABhY2NvdW50
+aW5nX21vZHVsZXMHAAAAdW5pY29kZXMIAAAAcmV2ZXJzYWxzCQAAAF9nZXRpdGVyX3MEAAAAbGlu
+ZSgAAAAAKAAAAABzDwAAAFNjcmlwdCAoUHl0aG9uKXMvAAAAQWNjb3VudGluZ1RyYW5zYWN0aW9u
+X2NyZWF0ZVJldmVyc2FsVHJhbnNhY3Rpb24BAAAAczoAAAAAAg8EGwEYAhIBEgESARIBDwEJAScB
+CQEoARcBEgEYBCsACQEPARIBEgESARIBEgESARUDIQEPAQkBKAEAAABzLwAAAEFjY291bnRpbmdU
+cmFuc2FjdGlvbl9jcmVhdGVSZXZlcnNhbFRyYW5zYWN0aW9uKAEAAABzLwAAAEFjY291bnRpbmdU
+cmFuc2FjdGlvbl9jcmVhdGVSZXZlcnNhbFRyYW5zYWN0aW9uKAAAAAAoAAAAAHMPAAAAU2NyaXB0
+IChQeXRob24pcwgAAAA8bW9kdWxlPgEAAABzAAAAAA==</string> </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/AccountingTransaction_createReversalTransaction</string> </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>N_</string>
+                            <string>accounting_module</string>
+                            <string>unicode</string>
+                            <string>reversal</string>
+                            <string>_getiter_</string>
+                            <string>line</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>AccountingTransaction_createReversalTransaction</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
-- 
2.30.9