[Erp5-report] r10559 - in /erp5/trunk/bt5/erp5_accounting: ActionTemplateItem/portal_types/...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 5 11:24:24 CEST 2006


Author: jerome
Date: Thu Oct  5 11:24:20 2006
New Revision: 10559

URL: http://svn.erp5.org?rev=10559&view=rev
Log:
Allow to choose the Bank Account when creating the related payment. Clean up
creation script.


Added:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog/your_payment.xml
Modified:
    erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Purchase%20Invoice%20Transaction/create_related_payment.xml
    erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Sale%20Invoice%20Transaction/create_related_payment.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Purchase%20Invoice%20Transaction/create_related_payment.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Purchase%2520Invoice%2520Transaction/create_related_payment.xml?rev=10559&r1=10558&r2=10559&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Purchase%20Invoice%20Transaction/create_related_payment.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Purchase%20Invoice%20Transaction/create_related_payment.xml Thu Oct  5 11:24:20 2006
@@ -102,7 +102,7 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>python: object.getCausalityRelatedValueList(portal_type=\'Payment Transaction\')</string> </value>
+            <value> <string>python: not object.getCausalityRelatedValueList(portal_type=\'Payment Transaction\')</string> </value>
         </item>
       </dictionary>
     </pickle>

Modified: erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Sale%20Invoice%20Transaction/create_related_payment.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Sale%2520Invoice%2520Transaction/create_related_payment.xml?rev=10559&r1=10558&r2=10559&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Sale%20Invoice%20Transaction/create_related_payment.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/ActionTemplateItem/portal_types/Sale%20Invoice%20Transaction/create_related_payment.xml Thu Oct  5 11:24:20 2006
@@ -102,7 +102,7 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>python: object.getCausalityRelatedValueList(portal_type=\'Payment Transaction\')</string> </value>
+            <value> <string>python: not object.getCausalityRelatedValueList(portal_type=\'Payment Transaction\')</string> </value>
         </item>
       </dictionary>
     </pickle>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml?rev=10559&r1=10558&r2=10559&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getBankAccountItemList.xml Thu Oct  5 11:24:20 2006
@@ -76,7 +76,7 @@
 \n
 organisation = portal.restrictedTraverse(organisation)\n
 item_list = [(\'\', \'\')]\n
-for bank in organisation.objectValues(portal_type = [\'Bank Account\', \'Cash Register\']):\n
+for bank in organisation.objectValues(portal_type=portal.getPortalPaymentNodeTypeList()):\n
   item_list.append((bank.getTitle(), bank.getRelativeUrl()))\n
 \n
 return item_list\n

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml?rev=10559&r1=10558&r2=10559&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_createRelatedPaymentTransaction.xml Thu Oct  5 11:24:20 2006
@@ -68,61 +68,46 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-"""Create a related payment transaction, using the account `node`, and setting\n
-the payment mode `payment_mode`.\n
+            <value> <string>"""Create a related payment transaction, using the account `node`, the payment\n
+`payment`, and setting the payment mode `payment_mode`.\n
 """\n
-\n
 from Products.ERP5Type.Message import Message\n
 N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
 \n
 portal = context.getPortalObject()\n
-accounting_module = portal.accounting_module\n
-bank_account = None\n
 payment_dict = {}\n
-is_source = context.getPortalTypeName() in ( \'Sale Invoice Transaction\',\n
-                                             \'Accounting Transaction\' )\n
-if is_source:\n
-  organisation = context.getDestinationSectionValue()\n
-  if len(organisation.objectValues(portal_type = [\'Bank Account\'])) > 0 :\n
-    bank_account = organisation.objectValues(portal_type = [\'Bank Account\'])[0].getRelativeUrl()\n
-  payment_dict[\'destination_payment_value\'] = bank_account\n
-  payment_dict[\'source_payment_value\'] = context.getSourcePayment()\n
-else:\n
-  organisation = context.getSourceSectionValue()\n
-  if len(organisation.objectValues(portal_type = [\'Bank Account\'])) > 0 :\n
-    bank_account = organisation.objectValues(portal_type = [\'Bank Account\'])[0].getRelativeUrl()\n
-  payment_dict[\'destination_payment_value\'] = bank_account\n
-  payment_dict[\'source_payment_value\'] = context.getSourcePayment()\n
-\n
-portal_type_mapping = {\n
-   \'Purchase Invoice Transaction\': \'Purchase Payment Transaction\',\n
-   \'Sale Invoice Transaction\': \'Payment Transaction\',\n
-}\n
-\n
-related_payement = accounting_module.newContent(\n
-  portal_type=portal_type_mapping.get(\n
-            context.getPortalTypeName(), "Payment Transaction"),\n
-  title = "R\xc3\xa9glement de %s" % (context.getReference() or context.getTitle()),\n
+is_source = context.AccountingTransaction_isSourceView()\n
+line_portal_type = \'Accounting Transaction Line\'\n
+\n
+related_payement = portal.accounting_module.newContent(\n
+  portal_type="Payment Transaction",\n
+  title = str(N_("Payment of ${invoice_title}",\n
+          mapping=dict(invoice_title=unicode((context.getReference() or\n
+                                              context.getTitle() or \'\'),\n
+                                              \'utf8\', \'repr\')))),\n
   source_section=context.getSourceSection(),\n
   destination_section=context.getDestinationSection(),\n
   stop_date=context.getStopDate(),\n
   start_date=context.getStartDate(),\n
   resource=context.getResource(),\n
   causality_value=context,\n
-  created_by_builder=1,\n
+  created_by_builder=1, # XXX this prevent init script from creating lines.\n
   payment_mode=payment_mode,\n
-  **payment_dict\n
 )\n
+if is_source:\n
+  related_payement.edit(destination_payment=context.getDestinationPayment(),\n
+                        source_payment=payment)\n
+else:\n
+  related_payement.edit(destination_payment=payment,\n
+              source_payment=context.getSourcePayment())\n
+\n
 \n
 bank = related_payement.newContent(\n
-      portal_type=\'Accounting Transaction Line\',\n
-      id=\'bank\',\n
+   portal_type=line_portal_type,\n
+   id=\'bank\',\n
 )\n
 \n
 bank_quantity = 0\n
-\n
 for line in context.objectValues(\n
             portal_type=portal.getPortalAccountingMovementTypeList()):\n
   if is_source:\n
@@ -133,9 +118,10 @@
   if account is not None and account.getAccountTypeId() in (\n
                                             \'payable\', \'receivable\'):\n
      related_payement.newContent(\n
-       source = line.getSource(),\n
-       destination = line.getDestination(),\n
-       quantity = - line.getQuantity())\n
+       portal_type=line_portal_type,\n
+       source=line.getSource(),\n
+       destination=line.getDestination(),\n
+       quantity= - line.getQuantity())\n
      bank_quantity += line.getQuantity()\n
 \n
 if is_source:\n
@@ -145,15 +131,14 @@
   bank.edit( destination=node,\n
              quantity=bank_quantity )\n
 \n
+# maybe stop is a bit too much ?\n
 related_payement.stop()\n
 \n
 if not batch_mode:\n
   return context.REQUEST.RESPONSE.redirect(\n
     "%s/view?portal_status_message=%s" % (\n
         related_payement.absolute_url(), N_(\'Related Payment Created\')))\n
-
-
-]]></string> </value>
+</string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -175,7 +160,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>node, payment_mode, batch_mode=0</string> </value>
+            <value> <string>node, payment_mode, payment=\'\', batch_mode=0</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -195,7 +180,7 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>3</int> </value>
+                        <value> <int>4</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
@@ -203,6 +188,7 @@
                           <tuple>
                             <string>node</string>
                             <string>payment_mode</string>
+                            <string>payment</string>
                             <string>batch_mode</string>
                             <string>Products.ERP5Type.Message</string>
                             <string>Message</string>
@@ -210,23 +196,19 @@
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>portal</string>
-                            <string>accounting_module</string>
-                            <string>None</string>
-                            <string>bank_account</string>
                             <string>payment_dict</string>
                             <string>is_source</string>
-                            <string>organisation</string>
-                            <string>len</string>
-                            <string>_getitem_</string>
-                            <string>_write_</string>
-                            <string>portal_type_mapping</string>
-                            <string>_apply_</string>
+                            <string>line_portal_type</string>
+                            <string>str</string>
+                            <string>dict</string>
+                            <string>unicode</string>
                             <string>related_payement</string>
                             <string>bank</string>
                             <string>bank_quantity</string>
                             <string>_getiter_</string>
                             <string>line</string>
                             <string>account</string>
+                            <string>None</string>
                           </tuple>
                         </value>
                     </item>
@@ -239,6 +221,7 @@
             <key> <string>func_defaults</string> </key>
             <value>
               <tuple>
+                <string></string>
                 <int>0</int>
               </tuple>
             </value>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog.xml?rev=10559&r1=10558&r2=10559&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog.xml Thu Oct  5 11:24:20 2006
@@ -97,6 +97,7 @@
                       <list>
                         <string>your_node</string>
                         <string>your_payment_mode</string>
+                        <string>your_payment</string>
                       </list>
                     </value>
                 </item>

Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog/your_payment.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog/your_payment.xml?rev=10559&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog/your_payment.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Invoice_viewCreateRelatedPaymentTransactionDialog/your_payment.xml Thu Oct  5 11:24:20 2006
@@ -1,0 +1,289 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.Formulator.StandardFields</string>
+          <string>ListField</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>your_payment</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+                <item>
+                    <key> <string>required_not_found</string> </key>
+                    <value> <string>Input is required but no input given.</string> </value>
+                </item>
+                <item>
+                    <key> <string>unknown_selection</string> </key>
+                    <value> <string>You selected an item that was not in the list.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>first_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>items</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>size</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>first_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>items</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>size</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>alternate_name</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>css_class</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>external_validator</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>extra_item</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>first_item</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>hidden</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>items</string> </key>
+                    <value>
+                      <list/>
+                    </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>size</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Bank Account</string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.Formulator.TALESField</string>
+          <string>TALESMethod</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>here/AccountModule_getBankAccountItemList</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=10559&r1=10558&r2=10559&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Thu Oct  5 11:24:20 2006
@@ -1,1 +1,1 @@
-65
+66




More information about the Erp5-report mailing list