Commit da5277ab authored by Sebastien Robin's avatar Sebastien Robin

fixed the way we call script inside scripts of check_payment workflow

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9605 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7bbbf49c
...@@ -134,7 +134,7 @@ for line in listbox:\n ...@@ -134,7 +134,7 @@ for line in listbox:\n
check_type_relative_url = check_type_relative_url[len(\'check_type/\'):]\n check_type_relative_url = check_type_relative_url[len(\'check_type/\'):]\n
line_kw_dict[\'check_type\'] = check_type_relative_url\n line_kw_dict[\'check_type\'] = check_type_relative_url\n
check_type = context.getPortalObject().restrictedTraverse(check_type_relative_url)\n check_type = context.getPortalObject().restrictedTraverse(check_type_relative_url)\n
line_kw_dict[\'price\'] = check_type.getQuantity()\n line_kw_dict[\'price\'] = check_type.getPrice()\n
line_kw_dict[\'price_currency\'] = check_type.getParentValue().getPriceCurrency()\n line_kw_dict[\'price_currency\'] = check_type.getParentValue().getPriceCurrency()\n
if add_line:\n if add_line:\n
number_of_line_created += 1\n number_of_line_created += 1\n
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<value> <value>
<list> <list>
<string>my_title</string> <string>my_title</string>
<string>my_quantity</string> <string>my_price</string>
<string>my_description</string> <string>my_description</string>
</list> </list>
</value> </value>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_quantity</string> </value> <value> <string>my_price</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -69,6 +69,9 @@ ...@@ -69,6 +69,9 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>context.setSource(context.getBaobabSource())\n <value> <string>context.setSource(context.getBaobabSource())\n
reference_currency = context.Baobab_getPortalReferenceCurrencyID()\n
context.setPriceCurrency(\'currency_module/%s\' %(reference_currency,))\n
context.setCurrencyExchangeType(\'transfer\')\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -118,6 +121,7 @@ ...@@ -118,6 +121,7 @@
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>reference_currency</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -345,6 +345,10 @@ ...@@ -345,6 +345,10 @@
<string>title</string> <string>title</string>
<string>Title</string> <string>Title</string>
</tuple> </tuple>
<tuple>
<string>price</string>
<string>Amount</string>
</tuple>
<tuple> <tuple>
<string>quantity</string> <string>quantity</string>
<string>Quantity</string> <string>Quantity</string>
......
...@@ -85,7 +85,7 @@ if not transaction.Baobab_checkCounterDateOpen(site=source, date=date):\n ...@@ -85,7 +85,7 @@ if not transaction.Baobab_checkCounterDateOpen(site=source, date=date):\n
\n \n
site = transaction.getSourceValue()\n site = transaction.getSourceValue()\n
\n \n
if not context.Baobab_checkCounterOpened(site):\n if not transaction.Baobab_checkCounterOpened(site):\n
msg = Message(domain = "ui", message="Counter is not opened")\n msg = Message(domain = "ui", message="Counter is not opened")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
...@@ -100,12 +100,12 @@ price = transaction.getSourceTotalAssetPrice()\n ...@@ -100,12 +100,12 @@ price = transaction.getSourceTotalAssetPrice()\n
bank_account.serialize()\n bank_account.serialize()\n
\n \n
# Make sure there are no other operations pending for this account\n # Make sure there are no other operations pending for this account\n
if context.BankAccount_isMessagePending(bank_account):\n if transaction.BankAccount_isMessagePending(bank_account):\n
msg = Message(domain=\'ui\', message="There are operations pending for this account that prevent form calculating its position. Please try again later.")\n msg = Message(domain=\'ui\', message="There are operations pending for this account that prevent form calculating its position. Please try again later.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
# Index the banking operation line so it impacts account position\n # Index the banking operation line so it impacts account position\n
context.BankingOperationLine_index(line)\n transaxtion.BankingOperationLine_index(line)\n
\n \n
# Check if the banking operation is correct. Do not depend on catalog because line might not be indexed immediatelly.\n # Check if the banking operation is correct. Do not depend on catalog because line might not be indexed immediatelly.\n
if - price != (line.getPrice() * line.getQuantity()):\n if - price != (line.getPrice() * line.getQuantity()):\n
...@@ -113,7 +113,7 @@ if - price != (line.getPrice() * line.getQuantity()):\n ...@@ -113,7 +113,7 @@ if - price != (line.getPrice() * line.getQuantity()):\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
\n \n
# Test if the account balance is sufficient.\n # Test if the account balance is sufficient.\n
error = context.BankAccount_checkBalance(bank_account.getRelativeUrl(), price)\n error = transaction.BankAccount_checkBalance(bank_account.getRelativeUrl(), price)\n
if error[\'error_code\'] == 1:\n if error[\'error_code\'] == 1:\n
msg = Message(domain=\'ui\', message="Bank account is not sufficient.")\n msg = Message(domain=\'ui\', message="Bank account is not sufficient.")\n
raise ValidationFailed, (msg,)\n raise ValidationFailed, (msg,)\n
...@@ -192,6 +192,7 @@ elif error[\'error_code\'] != 0:\n ...@@ -192,6 +192,7 @@ elif error[\'error_code\'] != 0:\n
<string>line</string> <string>line</string>
<string>bank_account</string> <string>bank_account</string>
<string>price</string> <string>price</string>
<string>transaxtion</string>
<string>error</string> <string>error</string>
</tuple> </tuple>
</value> </value>
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
<tuple> <tuple>
<string>Manager</string> <string>Manager</string>
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
<tuple> <tuple>
<string>Manager</string> <string>Manager</string>
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -68,7 +68,9 @@ ...@@ -68,7 +68,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n <value> <string encoding="cdata"><![CDATA[
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
\n \n
delivery = state_change.object\n delivery = state_change.object\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
...@@ -113,8 +115,9 @@ for line in line_list:\n ...@@ -113,8 +115,9 @@ for line in line_list:\n
item.setReference(reference_range_min)\n item.setReference(reference_range_min)\n
item.setTitle(reference_range_min)\n item.setTitle(reference_range_min)\n
reference_range_min = str(int(float(reference_range_min)) + 1)\n reference_range_min = str(int(float(reference_range_min)) + 1)\n
if resource.isQuantityRequired():\n if len(resource.objectValues())>0:\n
item.setQuantity(line.getPrice())\n item_type = line.getCheckTypeValue()\n
item.setPrice(item_type.getPrice())\n
item.setPriceCurrency(line.getPriceCurrency())\n item.setPriceCurrency(line.getPriceCurrency())\n
item.setDestinationPayment(line.getDestinationPayment())\n item.setDestinationPayment(line.getDestinationPayment())\n
item.setDestinationTrade(line.getDestinationTrade())\n item.setDestinationTrade(line.getDestinationTrade())\n
...@@ -126,7 +129,9 @@ for line in line_list:\n ...@@ -126,7 +129,9 @@ for line in line_list:\n
\n \n
# Finally set the aggregate list on the line\n # Finally set the aggregate list on the line\n
line.setAggregateValueList(aggregate_list)\n line.setAggregateValueList(aggregate_list)\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -205,6 +210,8 @@ for line in line_list:\n ...@@ -205,6 +210,8 @@ for line in line_list:\n
<string>str</string> <string>str</string>
<string>int</string> <string>int</string>
<string>float</string> <string>float</string>
<string>len</string>
<string>item_type</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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