Commit 67f61b3d authored by Aurel's avatar Aurel

many fix in wf scripts : more check, use fast=0 fro getTotalPrice and typo

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10795 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 35da203f
......@@ -79,8 +79,8 @@ resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_
\n
# Get price and total_price.\n
price = transaction.getSourceTotalAssetPrice()\n
input_cash = transaction.getTotalPrice(deliveryLineType=\'Incoming Cash Sorting Line\')\n
output_cash = transaction.getTotalPrice(deliveryLineType=\'Outgoing Cash Sorting Line\')\n
input_cash = transaction.getTotalPrice(fast=0,portal_type=(\'Incoming Cash Sorting Line\',\'Cash Delivery Cell\'))\n
output_cash = transaction.getTotalPrice(fast=0,portal_type=(\'Outgoing Cash Sorting Line\',\'Cash Delivery Cell\'))\n
\n
if input_cash != output_cash :\n
msg=Message(domain="ui", message="Incoming cash amount is different from outgoing cash amount.")\n
......
<?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>transaction = state_change.object\n
\n
# Check getBaobabSource and getBaobabDestination\n
transaction.Base_checkBaobabSourceAndDestination()\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>state_change, **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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>state_change</string>
<string>kw</string>
<string>_getattr_</string>
<string>transaction</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>validateSourceAndDestination</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -60,7 +60,7 @@
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
<value> <string>validateSourceAndDestination</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -98,8 +98,10 @@ if not transaction.Baobab_checkCounterDateOpen(site=outgoing_source, date=transa
resource_one = transaction.CashDelivery_checkCounterInventory(outgoing_source,portal_type=\'Outgoing Cash To Currency Sale Line\')\n
\n
\n
billetage_entre = transaction.getTotalPrice(deliveryLineType=\'Incoming Cash To Currency Sale Line\')\n
billetage_sorti = transaction.getTotalPrice(deliveryLineType=\'Outgoing Cash To Currency Sale Line\')\n
#billetage_entre = transaction.getTotalPrice(deliveryLineType=\'Incoming Cash To Currency Sale Line\')\n
billetage_entre = transaction.getTotalPrice(portal_type=[\'Incoming Cash To Currency Sale Line\',\'Cash Delivery Cell\'],fast=0)\n
#billetage_sorti = transaction.getTotalPrice(deliveryLineType=\'Outgoing Cash To Currency Sale Line\')\n
billetage_sorti = transaction.getTotalPrice(portal_type=[\'Outgoing Cash To Currency Sale Line\', \'Cash Delivery Cell\'],fast=0)\n
\n
\n
base_price = transaction.getSourceTotalAssetPrice()\n
......
......@@ -73,8 +73,14 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
\n
txn = state_change[\'object\']\n
in_list = txn.searchFolder(portal_type=\'Incoming Usual Cash Incident Line\')\n
out_list = txn.searchFolder(portal_type=\'Outgoing Usual Cash Incident Line\')\n
in_list = txn.objectValues(portal_type=\'Incoming Usual Cash Incident Line\')\n
out_list = txn.objectValues(portal_type=\'Outgoing Usual Cash Incident Line\')\n
\n
var_type =txn.getIncidentType()\n
var_source_transport =txn.getSourceTransport()\n
if (var_type == \'reception\' and var_source_transport is None):\n
msg = Message(domain = "ui", message="Remote Site not null.")\n
raise ValidationFailed, (msg,)\n
\n
price = txn.getSourceTotalAssetPrice()\n
in_price = txn.getTotalPrice(deliveryLineType=\'Incoming Usual Cash Incident Line\')\n
......@@ -97,6 +103,12 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p
<none/>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
......@@ -141,11 +153,14 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p
<string>_getattr_</string>
<string>in_list</string>
<string>out_list</string>
<string>var_type</string>
<string>var_source_transport</string>
<string>None</string>
<string>msg</string>
<string>price</string>
<string>in_price</string>
<string>out_price</string>
<string>len</string>
<string>msg</string>
</tuple>
</value>
</item>
......@@ -173,4 +188,25 @@ elif (in_price != 0 and in_price != price) or (out_price != 0 and out_price != p
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -74,9 +74,15 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
\n
transaction = state_change.object\n
\n
date = transaction.getStartDate()\n
vault = transaction.getSource()\n
vaultDestination = transaction.getDestination()\n
\n
# check we are in an opened accounting day\n
if not transaction.Baobab_checkCounterDateOpen(site=vault, date=date):\n
msg = Message(domain = "ui", message="Counter Date is not opened")\n
raise ValidationFailed, (msg,)\n
\n
if \'reserve\' in vault and \'salle_tri\' in vaultDestination:\n
msg = Message(domain="ui", message="Cannot transfer ressource to ${destination} from ${source}.",\n
mapping={\'source\':transaction.getSourceValue().getParentValue().getTitle(),\n
......@@ -149,6 +155,7 @@ elif resource <> 0 :\n
<string>Message</string>
<string>_getattr_</string>
<string>transaction</string>
<string>date</string>
<string>vault</string>
<string>vaultDestination</string>
<string>msg</string>
......
......@@ -42,8 +42,6 @@
<tuple>
<string>deliver</string>
<string>deliver_action</string>
<string>reject</string>
<string>reject_action</string>
</tuple>
</value>
</item>
......
......@@ -89,7 +89,7 @@
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
......
......@@ -89,7 +89,7 @@
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
......
......@@ -74,9 +74,16 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
\n
transaction = state_change.object\n
\n
date = transaction.getStartDate()\n
vault = transaction.getSource()\n
vaultDestination = transaction.getDestination()\n
\n
# check we are in an opened accounting day\n
if not transaction.Baobab_checkCounterDateOpen(site=vaultDestination, date=date):\n
msg = Message(domain = "ui", message="Counter Date is not opened")\n
raise ValidationFailed, (msg,)\n
\n
\n
if \'reserve\' in vault and \'salle_tri\' in vaultDestination:\n
msg = Message(domain="ui", message="Cannot transfer ressource to ${destination} from ${source}.",\n
mapping={\'source\':transaction.getSourceValue().getParentValue().getTitle(),\n
......@@ -149,6 +156,7 @@ elif resource <> 0 :\n
<string>Message</string>
<string>_getattr_</string>
<string>transaction</string>
<string>date</string>
<string>vault</string>
<string>vaultDestination</string>
<string>msg</string>
......
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