Commit 4ed21e83 authored by Sebastien Robin's avatar Sebastien Robin

added automated calculation of the aggregate resource in check payment.

added a reference on checkbook models

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14566 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 940c70ff
...@@ -69,18 +69,15 @@ ...@@ -69,18 +69,15 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Expression" module="Products.CMFCore.Expression"/>
<string>Products.CMFCore.Expression</string> <tuple/>
<string>Expression</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/CheckbookVaultTransfer_viewCheckbookInputDialog</string> </value> <value> <string>string:${object_url}/CheckbookDelivery_fastInputForm</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -88,11 +85,8 @@ ...@@ -88,11 +85,8 @@
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Expression" module="Products.CMFCore.Expression"/>
<string>Products.CMFCore.Expression</string> <tuple/>
<string>Expression</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
......
...@@ -67,11 +67,8 @@ ...@@ -67,11 +67,8 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Expression" module="Products.CMFCore.Expression"/>
<string>Products.CMFCore.Expression</string> <tuple/>
<string>Expression</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
......
...@@ -67,11 +67,8 @@ ...@@ -67,11 +67,8 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Expression" module="Products.CMFCore.Expression"/>
<string>Products.CMFCore.Expression</string> <tuple/>
<string>Expression</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
......
...@@ -67,11 +67,8 @@ ...@@ -67,11 +67,8 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Expression" module="Products.CMFCore.Expression"/>
<string>Products.CMFCore.Expression</string> <tuple/>
<string>Expression</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
......
...@@ -67,11 +67,8 @@ ...@@ -67,11 +67,8 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Expression" module="Products.CMFCore.Expression"/>
<string>Products.CMFCore.Expression</string> <tuple/>
<string>Expression</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
......
...@@ -535,7 +535,7 @@ ...@@ -535,7 +535,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>method_name</string> </key> <key> <string>method_name</string> </key>
<value> <string>ListBox_initializeFastInput</string> </value> <value> <string>ListBox_listCheckbook</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
......
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
<string>my_title</string> <string>my_title</string>
<string>my_account_number_enabled</string> <string>my_account_number_enabled</string>
<string>my_fixed_price</string> <string>my_fixed_price</string>
<string>my_reference</string>
<string>my_description</string> <string>my_description</string>
</list> </list>
</value> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_reference</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>too_long</string> </key>
<value> <string>Too much input was given.</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>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</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>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</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>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</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>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</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>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </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>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Reference</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <int>0</int> </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>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</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># Look at all items availables for the source and then\n
# display them on a listbox so that the user will be able\n
# to select them\n
from DateTime import DateTime\n
request = context.REQUEST\n
item_portal_type_list = ["Checkbook","Check"]\n
node = context.getBaobabSource()\n
#item_portal_type_list = request.get(\'item_portal_type_list\', ["Checkbook","Check"])\n
#node = request.get(\'node\', request.get(\'vault\', context.getBaobabSource()))\n
reference_date = DateTime()\n
item_list = []\n
listbox = []\n
invalid_check_state_list = (\'draft\', \'confirmed\')\n
\n
getCurrentTrackingList = context.portal_simulation.getCurrentTrackingList\n
current_tracking_list = [x.getObject() for x in getCurrentTrackingList(\n
at_date=reference_date, node=node,\n
where_expression="item_catalog.portal_type=\'Check\' or item_catalog.portal_type=\'Checkbook\'")]\n
for item in current_tracking_list:\n
item_portal_type = item.getPortalType()\n
if item_portal_type in item_portal_type_list:\n
item_dict = {}\n
if item_portal_type==\'Check\':\n
if item.getSimulationState() not in invalid_check_state_list:\n
continue\n
item_dict[\'reference_range_max\'] = item.getReference()\n
item_dict[\'reference_range_min\'] = item.getReference()\n
else:\n
item_dict[\'reference_range_min\'] = item.getReferenceRangeMin()\n
item_dict[\'reference_range_max\'] = item.getReferenceRangeMax()\n
item_dict[\'resource_title\'] = item.getResourceTitle()\n
item_dict[\'destination_trade\'] = item.getDestinationTradeTitle()\n
item_dict[\'check_amount_title\'] = item.getCheckAmountTitle()\n
item_dict[\'selection\'] = 0\n
item_dict[\'uid\'] = \'new_%s\' %(item.getUid(),)\n
listbox.append(item_dict)\n
\n
context.Base_updateDialogForm(listbox=listbox)\n
return context.ListBox_initializeFastInput()\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>*args, **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>args</string>
<string>kw</string>
<string>DateTime</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
<string>item_portal_type_list</string>
<string>node</string>
<string>reference_date</string>
<string>item_list</string>
<string>listbox</string>
<string>invalid_check_state_list</string>
<string>getCurrentTrackingList</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>current_tracking_list</string>
<string>item</string>
<string>item_portal_type</string>
<string>item_dict</string>
<string>_write_</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>ListBox_listCheckbook</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -69,15 +69,12 @@ ...@@ -69,15 +69,12 @@
\n \n
for check_operation_line in transaction.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n for check_operation_line in transaction.contentValues(filter = {\'portal_type\' : \'Check Operation Line\'}):\n
source_bank_account = check_operation_line.getSourcePaymentValue()\n source_bank_account = check_operation_line.getSourcePaymentValue()\n
check_number = check_operation_line.getAggregateFreeText()\n
check = transaction.Base_checkOrCreateCheck(reference=check_number)\n
# immediate reindex is required to make this operation atomic.\n # immediate reindex is required to make this operation atomic.\n
transaction.newContent(portal_type = \'Banking Operation Line\',\n transaction.newContent(portal_type = \'Banking Operation Line\',\n
source_credit = check_operation_line.getPrice(),\n source_credit = check_operation_line.getPrice(),\n
source_payment_value = source_bank_account,)\n source_payment_value = source_bank_account,)\n
# this prevents multiple transactions from being committed at the same time for this bank account.\n # this prevents multiple transactions from being committed at the same time for this bank account.\n
source_bank_account.serialize()\n source_bank_account.serialize()\n
check_operation_line.edit(aggregate = check.getRelativeUrl())\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -139,8 +136,6 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\' ...@@ -139,8 +136,6 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\'
<string>_getattr_</string> <string>_getattr_</string>
<string>check_operation_line</string> <string>check_operation_line</string>
<string>source_bank_account</string> <string>source_bank_account</string>
<string>check_number</string>
<string>check</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -122,8 +122,10 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\' ...@@ -122,8 +122,10 @@ for check_operation_line in transaction.contentValues(filter = {\'portal_type\'
msg = Message(domain=\'ui\', message="Unknown error code.")\n msg = Message(domain=\'ui\', message="Unknown error code.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
transaction.Base_checkCheck(bank_account=source_bank_account, reference=check_number,\n check = transaction.Base_checkCheck(bank_account=source_bank_account, reference=check_number,\n
resource=check_type)\n resource=check_type)\n
if check_operation_line.getAggregate() != check.getRelativeUrl():\n
check_operation_line.edit(aggregate=check.getRelativeUrl())\n
\n \n
if transaction.getSimulationState() == "draft":\n if transaction.getSimulationState() == "draft":\n
context.updateBankingOperation(state_change)\n context.updateBankingOperation(state_change)\n
...@@ -204,6 +206,7 @@ if transaction.getSimulationState() == "draft":\n ...@@ -204,6 +206,7 @@ if transaction.getSimulationState() == "draft":\n
<string>source_bank_account</string> <string>source_bank_account</string>
<string>context</string> <string>context</string>
<string>error</string> <string>error</string>
<string>check</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -122,6 +122,18 @@ if bank_account is None:\n ...@@ -122,6 +122,18 @@ if bank_account is None:\n
# Check the check.\n # Check the check.\n
check_number = transaction.getAggregateFreeText()\n check_number = transaction.getAggregateFreeText()\n
check_resource = transaction.getAggregateResource()\n check_resource = transaction.getAggregateResource()\n
\n
# Automated calculation of the aggregate resource\n
if check_resource is None:\n
entity_portal_type = bank_account.getParentValue().getPortalType()\n
check_model_reference = None\n
if entity_portal_type == \'Person\':\n
check_model_reference = \'CCOP\'\n
elif entity_portal_type == \'Organisation\':\n
check_model_reference = \'CCOP\'\n
check_resource = transaction.Base_getCheckModelByReference(\n
reference=check_model_reference).getRelativeUrl()\n
\n
if not check_number:\n if not check_number:\n
msg = Message(domain=\'ui\', message="Check not defined.")\n msg = Message(domain=\'ui\', message="Check not defined.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
...@@ -214,6 +226,8 @@ context.updateBankingOperation(state_change)\n ...@@ -214,6 +226,8 @@ context.updateBankingOperation(state_change)\n
<string>bank_account</string> <string>bank_account</string>
<string>check_number</string> <string>check_number</string>
<string>check_resource</string> <string>check_resource</string>
<string>entity_portal_type</string>
<string>check_model_reference</string>
<string>check</string> <string>check</string>
<string>context</string> <string>context</string>
</tuple> </tuple>
......
...@@ -70,6 +70,14 @@ ...@@ -70,6 +70,14 @@
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
transaction = state_change.object\n transaction = state_change.object\n
\n \n
# Check getBaobabSource and getBaobabDestination\n
transaction.Base_checkBaobabSourceAndDestination()\n
\n
portal = transaction.getPortalObject()\n
portal_activities = portal.portal_activities\n
line_list = transaction.objectValues()\n
encountered_check_identifiers_dict = {}\n
\n
def getReference(reference):\n def getReference(reference):\n
"""\n """\n
Convert a reference into an int.\n Convert a reference into an int.\n
...@@ -129,11 +137,10 @@ def assertReferenceMatchListEmpty(match_list):\n ...@@ -129,11 +137,10 @@ def assertReferenceMatchListEmpty(match_list):\n
matched_reference_list.append(match.getReference())\n matched_reference_list.append(match.getReference())\n
raise ValidationFailed, \'The following references are already allocated : %s\' % (matched_reference_list, )\n raise ValidationFailed, \'The following references are already allocated : %s\' % (matched_reference_list, )\n
\n \n
def checkReferenceListUniqueness(reference_list, model, destination_payment):\n def checkReferenceListUniqueness(reference_list, model, destination_payment_uid):\n
"""\n """\n
Check each given reference not to already exist.\n Check each given reference not to already exist.\n
"""\n """\n
destination_payment_uid = destination_payment.getUid()\n
match_list = portal.portal_catalog(portal_type=\'Check\', reference=reference_list, destination_payment_uid=destination_payment_uid, resource_relative_url=model)\n match_list = portal.portal_catalog(portal_type=\'Check\', reference=reference_list, destination_payment_uid=destination_payment_uid, resource_relative_url=model)\n
assertReferenceMatchListEmpty(match_list)\n assertReferenceMatchListEmpty(match_list)\n
for reference in reference_list:\n for reference in reference_list:\n
...@@ -141,25 +148,13 @@ def checkReferenceListUniqueness(reference_list, model, destination_payment):\n ...@@ -141,25 +148,13 @@ def checkReferenceListUniqueness(reference_list, model, destination_payment):\n
if encountered_check_identifiers_dict.has_key(tag) or portal_activities.countMessageWithTag(tag) != 0:\n if encountered_check_identifiers_dict.has_key(tag) or portal_activities.countMessageWithTag(tag) != 0:\n
raise ValidationFailed, \'The following references are already allocated : %s\' % ([reference, ], )\n raise ValidationFailed, \'The following references are already allocated : %s\' % ([reference, ], )\n
\n \n
portal_activities = context.getPortalObject().portal_activities\n def checkReferenceUniqueness(reference, model, destination_payment_uid):\n
def checkReferenceUniqueness(reference, model, destination_payment):\n
"""\n """\n
Check the given reference not to already exist.\n Check the given reference not to already exist.\n
"""\n """\n
checkReferenceListUniqueness([reference, ], model, destination_payment)\n checkReferenceListUniqueness([reference, ], model, destination_payment_uid)\n
\n
# Check getBaobabSource and getBaobabDestination\n
transaction.Base_checkBaobabSourceAndDestination()\n
\n
delivery = state_change.object\n
portal = context.getPortalObject()\n
\n
# We must parse all lines of checkbook reception and then\n
# generate all items. We do not need to check data\n
# because everything is already checked in the fast input\n
line_list = delivery.objectValues(portal_type=delivery.getPortalType() + \' Line\')\n
\n \n
encountered_check_identifiers_dict = {}\n start_date = transaction.getStartDate()\n
\n \n
for line in line_list:\n for line in line_list:\n
quantity = line.getQuantity()\n quantity = line.getQuantity()\n
...@@ -192,30 +187,35 @@ for line in line_list:\n ...@@ -192,30 +187,35 @@ for line in line_list:\n
else:\n else:\n
reference_to_int = getReference\n reference_to_int = getReference\n
int_to_reference = generateReference\n int_to_reference = generateReference\n
\n
if resource.getAccountNumberEnabled():\n
destination_payment_value = line.getDestinationPaymentValue()\n
destination_payment_value.serialize()\n
destination_payment_uid = destination_payment_value.getUid()\n
destination_trade = line.getDestinationTrade()\n
else:\n
destination_payment_value = None\n
destination_payment_uid = "dummy"\n
\n \n
aggregate_list = []\n aggregate_list = []\n
for i in xrange(quantity):\n for i in xrange(quantity):\n
item = module.newContent()\n item = module.newContent()\n
item.setDestinationPayment(line.getDestinationPayment())\n if destination_payment_value is not None:\n
item.getDestinationPaymentValue().serialize() # To prevent multiple zeo nodes from creating checks for the same account, since they would not be able to see each other\'s activities.\n item.setDestinationPaymentValue(destination_payment_value)\n
item.setDestinationTrade(line.getDestinationTrade())\n item.setDestinationTrade(destination_trade)\n
if is_checkbook:\n if is_checkbook:\n
item.setResourceValue(resource)\n
item.setReferenceRangeMin(reference_range_min)\n
last_reference_value = reference_to_int(reference_range_min) + check_quantity - 1\n last_reference_value = reference_to_int(reference_range_min) + check_quantity - 1\n
reference_list = [int_to_reference(x, reference_range_min) for x in range(reference_to_int(reference_range_min), last_reference_value + 1)]\n
checkReferenceListUniqueness(reference_list, model, destination_payment_uid)\n
reference_range_max = int_to_reference(last_reference_value, reference_range_min)\n reference_range_max = int_to_reference(last_reference_value, reference_range_min)\n
item.setReferenceRangeMax(reference_range_max)\n item.setReferenceRangeMax(reference_range_max)\n
item.setReferenceRangeMin(reference_range_min)\n
item.setResourceValue(resource)\n
item.setStartDate(start_date)\n
item.setTitle(\'%s - %s\' % (reference_range_min, reference_range_max))\n item.setTitle(\'%s - %s\' % (reference_range_min, reference_range_max))\n
item.setCheckAmount(check_amount)\n item.setCheckAmount(check_amount)\n
\n
start_date = transaction.getStartDate()\n
destination_section = item.getDestinationSection()\n destination_section = item.getDestinationSection()\n
item.setStartDate(start_date)\n
reference_list = range(reference_to_int(reference_range_min), last_reference_value + 1)\n
checkReferenceListUniqueness(reference_list, model, item.getDestinationPaymentValue())\n
destination_payment_uid = item.getDestinationPaymentValue().getUid()\n
for j in reference_list:\n for j in reference_list:\n
reference = int_to_reference(j, reference_range_min)\n
tag = \'check_%s_%s_%s\' % (model, destination_payment_uid, reference)\n tag = \'check_%s_%s_%s\' % (model, destination_payment_uid, reference)\n
encountered_check_identifiers_dict[tag] = None\n encountered_check_identifiers_dict[tag] = None\n
check = item.newContent(portal_type=\'Check\', title=str(reference), activate_kw={\'tag\': tag})\n check = item.newContent(portal_type=\'Check\', title=str(reference), activate_kw={\'tag\': tag})\n
...@@ -224,7 +224,7 @@ for line in line_list:\n ...@@ -224,7 +224,7 @@ for line in line_list:\n
check.setReference(reference)\n check.setReference(reference)\n
check.setResource(model)\n check.setResource(model)\n
else:\n else:\n
checkReferenceUniqueness(reference_range_min, model, line.getDestinationPaymentValue())\n checkReferenceUniqueness(reference_range_min, model, destination_payment_uid)\n
item.setReference(reference_range_min)\n item.setReference(reference_range_min)\n
item.setResource(model)\n item.setResource(model)\n
item.setTitle(reference_range_min)\n item.setTitle(reference_range_min)\n
...@@ -233,9 +233,9 @@ for line in line_list:\n ...@@ -233,9 +233,9 @@ for line in line_list:\n
item.setPrice(item_type.getPrice())\n item.setPrice(item_type.getPrice())\n
item.setPriceCurrency(line.getPriceCurrency())\n item.setPriceCurrency(line.getPriceCurrency())\n
last_reference_value = reference_to_int(reference_range_min)\n last_reference_value = reference_to_int(reference_range_min)\n
# Trigger a dummy activity just to avoi dbeing able to create that check multiple times in the same checkbook reception\n tag = \'check_%s_%s_%s\' % (model, destination_payment_uid, reference_range_min)\n
tag = \'check_%s_%s_%s\' % (model, line.getDestinationPaymentValue().getUid(), reference_range_min)\n
encountered_check_identifiers_dict[tag] = None\n encountered_check_identifiers_dict[tag] = None\n
# Trigger a dummy activity just to avoi dbeing able to create that check multiple times in the same checkbook reception\n
item.activate(tag=tag).getUid()\n item.activate(tag=tag).getUid()\n
# update reference_range_min for the next pass\n # update reference_range_min for the next pass\n
reference_range_min = int_to_reference(last_reference_value + 1, reference_range_min)\n reference_range_min = int_to_reference(last_reference_value + 1, reference_range_min)\n
...@@ -302,6 +302,10 @@ for line in line_list:\n ...@@ -302,6 +302,10 @@ for line in line_list:\n
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>transaction</string> <string>transaction</string>
<string>portal</string>
<string>portal_activities</string>
<string>line_list</string>
<string>encountered_check_identifiers_dict</string>
<string>getReference</string> <string>getReference</string>
<string>generateReference</string> <string>generateReference</string>
<string>validateTravelerCheckReferenceFormat</string> <string>validateTravelerCheckReferenceFormat</string>
...@@ -309,14 +313,9 @@ for line in line_list:\n ...@@ -309,14 +313,9 @@ for line in line_list:\n
<string>getTravelerCheckReferencePrefix</string> <string>getTravelerCheckReferencePrefix</string>
<string>generateTravelerCheckReference</string> <string>generateTravelerCheckReference</string>
<string>assertReferenceMatchListEmpty</string> <string>assertReferenceMatchListEmpty</string>
<string>portal</string>
<string>encountered_check_identifiers_dict</string>
<string>portal_activities</string>
<string>checkReferenceListUniqueness</string> <string>checkReferenceListUniqueness</string>
<string>context</string>
<string>checkReferenceUniqueness</string> <string>checkReferenceUniqueness</string>
<string>delivery</string> <string>start_date</string>
<string>line_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>line</string> <string>line</string>
<string>quantity</string> <string>quantity</string>
...@@ -333,21 +332,25 @@ for line in line_list:\n ...@@ -333,21 +332,25 @@ for line in line_list:\n
<string>reference_to_int</string> <string>reference_to_int</string>
<string>int_to_reference</string> <string>int_to_reference</string>
<string>False</string> <string>False</string>
<string>destination_payment_value</string>
<string>destination_payment_uid</string>
<string>destination_trade</string>
<string>None</string>
<string>aggregate_list</string> <string>aggregate_list</string>
<string>xrange</string> <string>xrange</string>
<string>i</string> <string>i</string>
<string>item</string> <string>item</string>
<string>last_reference_value</string> <string>last_reference_value</string>
<string>reference_range_max</string> <string>append</string>
<string>start_date</string> <string>$append0</string>
<string>destination_section</string>
<string>range</string> <string>range</string>
<string>x</string>
<string>reference_list</string> <string>reference_list</string>
<string>destination_payment_uid</string> <string>reference_range_max</string>
<string>destination_section</string>
<string>j</string> <string>j</string>
<string>reference</string> <string>reference</string>
<string>tag</string> <string>tag</string>
<string>None</string>
<string>_write_</string> <string>_write_</string>
<string>str</string> <string>str</string>
<string>check</string> <string>check</string>
......
233 238
\ No newline at end of file \ 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