Commit 645b01e4 authored by Aurel's avatar Aurel

workflow state/transition title change

fix wf for dematerialization

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15799 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b9942982
......@@ -61,7 +61,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Terminate the operation</string> </value>
<value> <string>Deliver</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
......@@ -73,11 +73,8 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.Guard</string>
<string>Guard</string>
</tuple>
<none/>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......
......@@ -27,7 +27,7 @@
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string>Delivered</string> </value>
<value> <string>Deliver</string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
......@@ -73,11 +73,8 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.Guard</string>
<string>Guard</string>
</tuple>
<none/>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......
......@@ -37,7 +37,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Terminate the operation</string> </value>
<value> <string>Delivered</string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
......
......@@ -55,7 +55,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Delivered</string> </value>
<value> <string>Deliver</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
......@@ -67,11 +67,8 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.Guard</string>
<string>Guard</string>
</tuple>
<none/>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......
......@@ -21,7 +21,7 @@
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string>Delivered</string> </value>
<value> <string>Deliver</string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
......@@ -67,11 +67,8 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.Guard</string>
<string>Guard</string>
</tuple>
<none/>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......
......@@ -71,9 +71,8 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
\n
transaction = state_change[\'object\']\n
\n
transaction.log("transaction", "validateVaultBalance")\n
vault = transaction.getSource()\n
resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Monetary Destruction Line\')\n
\n
source_object = context.portal_categories.getCategoryValue(vault)\n
\n
......@@ -94,23 +93,11 @@ if \'encaisse_des_externes\' in vault:\n
\n
\n
\n
# Get price and total_price.\n
amount = transaction.getSourceTotalAssetPrice()\n
total_price = transaction.getTotalPrice(portal_type=[\'Monetary Destruction Line\',\'Monetary Destruction Cell\'],fast=0)\n
\n
if resource == 2:\n
msg = Message(domain="ui", message="No Resource.")\n
raise ValidationFailed, (msg,)\n
elif amount != total_price:\n
msg = Message(domain="ui", message="Amount differ from total price.")\n
raise ValidationFailed, (msg,)\n
elif resource <> 0 :\n
msg = Message(domain="ui", message="Insufficient Balance.")\n
raise ValidationFailed, (msg,)\n
\n
# In case of dematerialization, we must have only coins\n
transaction.log("isDematerialization", transaction.isDematerialization())\n
if transaction.isDematerialization():\n
for line in transaction.objectValues(portal_type=\'Cash Delivery Line\'):\n
for line in transaction.objectValues(portal_type=\'Monetary Destruction Line\'):\n
transaction.log("line", line.getResourceValue().getPortalType())\n
if line.getResourceValue().getPortalType() != \'Coin\':\n
msg = Message(domain="ui", message="Sorry, dematerialization is possible only with coins.")\n
raise ValidationFailed, (msg,)\n
......@@ -122,6 +109,22 @@ if transaction.isDematerialization():\n
if not \'encaisse_des_billets_retires_de_la_circulation\' in vault:\n
msg = Message(domain="ui", message="Invalid source.")\n
raise ValidationFailed, (msg,)\n
\n
\n
# Get price and total_price.\n
amount = transaction.getSourceTotalAssetPrice()\n
total_price = transaction.getTotalPrice(portal_type=[\'Monetary Destruction Line\',\'Monetary Destruction Cell\'],fast=0)\n
resource = transaction.CashDelivery_checkCounterInventory(source=vault, portal_type=\'Monetary Destruction Line\')\n
\n
if resource == 2:\n
msg = Message(domain="ui", message="No Resource.")\n
raise ValidationFailed, (msg,)\n
elif amount != total_price:\n
msg = Message(domain="ui", message="Amount differ from total price.")\n
raise ValidationFailed, (msg,)\n
elif resource <> 0 :\n
msg = Message(domain="ui", message="Insufficient Balance.")\n
raise ValidationFailed, (msg,)\n
]]></string> </value>
......@@ -177,16 +180,16 @@ if transaction.isDematerialization():\n
<string>transaction</string>
<string>_getattr_</string>
<string>vault</string>
<string>resource</string>
<string>context</string>
<string>source_object</string>
<string>msg</string>
<string>source_section</string>
<string>None</string>
<string>amount</string>
<string>total_price</string>
<string>_getiter_</string>
<string>line</string>
<string>amount</string>
<string>total_price</string>
<string>resource</string>
</tuple>
</value>
</item>
......
......@@ -108,7 +108,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: \'externe\' in here.getSource() or here.isDematerialization()</string> </value>
<value> <string>python: \'externe\' in here.getSource() or not here.isDematerialization()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -108,7 +108,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: \'externe\' not in here.getSource() and not here.isDematerialization()</string> </value>
<value> <string>python: \'externe\' not in here.getSource() and here.isDematerialization()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -61,7 +61,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Delivered</string> </value>
<value> <string>Deliver</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
......
......@@ -27,7 +27,7 @@
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string>Delivered</string> </value>
<value> <string>Deliver</string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
......
476
\ No newline at end of file
479
\ 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