Commit 028e3a2d authored by Sebastien Robin's avatar Sebastien Robin

Added generic script in order to check check and checkbook stock values. Use...

Added generic script in order to check check and checkbook stock values. Use this script for checkbook usual cash transfer.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13976 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ac172271
<?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>current_tracking_list = [x.getObject() for x in context.portal_simulation.getCurrentTrackingList(\n
at_date=at_date, node=node_url,\n
where_expression="item_catalog.portal_type=\'Check\' or item_catalog.portal_type=\'Checkbook\'")]\n
aggregate_uid_list = [x.uid for x in current_tracking_list]\n
for line in context.getMovementList():\n
for aggregate_uid in line.getAggregateUidList():\n
if aggregate_uid not in aggregate_uid_list:\n
aggregate_value = context.portal_catalog(uid=aggregate_uid)[0].getObject()\n
msg = Message(domain="ui", message="Sorry, the item with reference $reference is not available any more",\n
mapping={\'reference\':aggregate_value.getReference()})\n
raise ValidationFailed, (msg,)\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>node_url=None, at_date=None</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>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>node_url</string>
<string>at_date</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>context</string>
<string>x</string>
<string>current_tracking_list</string>
<string>aggregate_uid_list</string>
<string>line</string>
<string>aggregate_uid</string>
<string>_getitem_</string>
<string>aggregate_value</string>
<string>Message</string>
<string>msg</string>
<string>ValidationFailed</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>CheckbookDelivery_checkAggregateStockList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -83,15 +83,8 @@ if len(line_list)==0:\n
msg = Message(domain="ui", message="Sorry, you must select at least one check or checkbook")\n
\n
baobab_source = transaction.getBaobabSource()\n
reference_date = transaction.getStartDate()\n
current_tracking_list = [x.getObject() for x in transaction.portal_simulation.getCurrentTrackingList(\n
at_date=reference_date, node=baobab_source,\n
where_expression="item_catalog.portal_type=\'Check\' or item_catalog.portal_type=\'Checkbook\'")]\n
aggregate_uid_list = [x.uid for x in current_tracking_list]\n
for line in transaction.getMovementList(portal_type=\'Checkbook Delivery Line\'):\n
for aggregate_uid in line.getAggregateUidList():\n
if aggregate_uid not in aggregate_uid_list:\n
msg = Message(domain="ui", message="Sorry, an item is not available any more")\n
at_date = transaction.getStartDate()\n
context.CheckbookDelivery_checkAggregateStockList(at_date=at_date, node_url = baobab_source)\n
\n
if msg is not None:\n
raise ValidationFailed, (msg,)\n
......@@ -151,15 +144,8 @@ if msg is not None:\n
<string>line_list</string>
<string>len</string>
<string>baobab_source</string>
<string>reference_date</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>current_tracking_list</string>
<string>aggregate_uid_list</string>
<string>line</string>
<string>aggregate_uid</string>
<string>at_date</string>
<string>context</string>
</tuple>
</value>
</item>
......
145
\ No newline at end of file
148
\ 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