Commit 883837b0 authored by Jérome Perrin's avatar Jérome Perrin

Add a Transfer_getPaymentTransactionList script to return the list of related

transaction in a stable order (sorted on source/destination_reference), and use
it on all Transfer forms.
Improve script to text to display on the transfer
(PaymentTransaction_getTransferReference)



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13126 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fb95e437
......@@ -68,15 +68,49 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>transaction_portal_type = context.getPortalAccountingTransactionTypeList()\n
<value> <string>""" The label to display for a payment transaction\n
"""\n
\n
transaction_portal_type = context.getPortalAccountingTransactionTypeList()\n
\n
transfer_reference = context.getShortTitle()\n
if transfer_reference:\n
return transfer_reference\n
\n
\n
invoice = context.getDefaultCausalityValue(portal_type=transaction_portal_type)\n
\n
if context.getOriginId() == \'OP\':\n
libel = ""\n
if context.getDescription():\n
libel = context.getDescription().splitlines()[0]\n
elif invoice is not None and invoice.getDescription():\n
libel = (invoice.getDescription() or \'\').splitlines()[0]\n
else:\n
libel = context.getTitle()\n
return "%05d %s" % (context.getIntIndex(), libel)\n
\n
if invoice is not None:\n
return invoice.getReference()\n
libel = \'\'\n
# XXX an ad hoc local property can be used as int_index.\n
if context.getProperty(\'numdd\'):\n
libel = context.getProperty(\'numdd\')\n
else:\n
libel = "%05d" % invoice.getIntIndex()\n
\n
if invoice.AccountingTransaction_isSourceView():\n
bank_account = invoice.getDestinationPaymentValue()\n
if bank_account.getPortalType() == \'External Payment\':\n
libel += \' %s\' % invoice.getDestinationSectionTitle()\n
else:\n
bank_account = invoice.getSourcePaymentValue()\n
if bank_account.getPortalType() == \'External Payment\':\n
libel += \' %s\' % invoice.getSourceSectionTitle()\n
\n
invoice_description = invoice.getDescription() or invoice.getTitle()\n
\n
return "%s %s" % (libel, invoice_description.splitlines()[0])\n
\n
return \'\'\n
</string> </value>
</item>
<item>
......@@ -130,7 +164,11 @@ if invoice is not None:\n
<string>transaction_portal_type</string>
<string>transfer_reference</string>
<string>invoice</string>
<string>libel</string>
<string>_getitem_</string>
<string>None</string>
<string>bank_account</string>
<string>invoice_description</string>
</tuple>
</value>
</item>
......
<?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>
<none/>
</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>numordre_cache = dict()\n
def getNumordre(tr):\n
\'\'\'calculate numordre and cache it.\n
\'\'\'\n
try:\n
return numordre_cache[tr]\n
except KeyError:\n
return numordre_cache.setdefault(tr, tr.getProperty(\'noordre\',\n
tr.getSourceReference()))\n
\n
def transfer_comparator(a, b):\n
\'\'\'Compare 2 accounting transactions.\n
\'\'\'\n
return cmp(getNumordre(a), getNumordre(b))\n
\n
\n
def getPaymentTransactionList():\n
transaction_list = context.getAggregateRelatedValueList(\n
portal_type=\'Payment Transaction\')\n
transaction_list.sort(transfer_comparator)\n
return transaction_list\n
\n
from Products.ERP5Type.Cache import CachingMethod\n
no_getPaymentTransactionList = CachingMethod(\n
getPaymentTransactionList,\n
id=\'%s%s\' % (script.getId(),\n
context.getId()))\n
\n
\n
return getPaymentTransactionList()\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</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>kw</string>
<string>dict</string>
<string>numordre_cache</string>
<string>getNumordre</string>
<string>transfer_comparator</string>
<string>getPaymentTransactionList</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>_getattr_</string>
<string>script</string>
<string>context</string>
<string>no_getPaymentTransactionList</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>Transfer_getPaymentTransactionList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -585,7 +585,7 @@ python:"accounting_module/view?reset:int=1&uid:list=%s" % ("&uid:list=".join([st
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>getAggregateRelatedValueList</string> </value>
<value> <string>Transfer_getPaymentTransactionList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -189,11 +189,11 @@
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
<value> <string>figure</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>figure</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -563,7 +563,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>getAggregateRelatedValueList</string> </value>
<value> <string>Transfer_getPaymentTransactionList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -562,7 +562,7 @@
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>getAggregateRelatedValueList</string> </value>
<value> <string>Transfer_getPaymentTransactionList</string> </value>
</item>
</dictionary>
</pickle>
......
80
\ No newline at end of file
78
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment