Commit 142c386f authored by Vincent Pelletier's avatar Vincent Pelletier

Factorise code used to know if a bank account is opened.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28779 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 94605b13
......@@ -72,7 +72,6 @@
# returns a dictionnary like : {\'error_code\', \'balance\'}\n
\n
#workflow_id = \'bank_account_workflow\'\n
workflow_correct_state_list = (\'valid\', \'being_modified\', \'validating_modification\')\n
manual_validation_account_category_list = (\'test\',)\n
\n
# First check that the payment account is in an acceptable state\n
......@@ -80,7 +79,7 @@ manual_validation_account_category_list = (\'test\',)\n
payment_value = context.restrictedTraverse(payment)\n
payment_state = payment_value.getValidationState()\n
\n
if payment_state not in workflow_correct_state_list :\n
if not context.BankAccount_isOpened():\n
return {\'error_code\':2} # closed account\n
\n
resource = payment_value.getPriceCurrencyValue()\n
......@@ -163,7 +162,6 @@ return {\'error_code\':0, \'balance\':account_balance} # ok\n
<string>payment</string>
<string>quantity</string>
<string>src__</string>
<string>workflow_correct_state_list</string>
<string>manual_validation_account_category_list</string>
<string>_getattr_</string>
<string>context</string>
......
......@@ -70,14 +70,13 @@
# check that the amount of `resource` in account `payment` is greater than or equal to `quantity`\n
# returns a dictionnary like : {\'error_code\', \'balance\'}\n
\n
workflow_correct_state_list = (\'valid\', \'being_modified\', \'validating_modification\')\n
manual_validation_account_category_list = (\'test\',)\n
\n
# First check that the payment account is in an acceptable state\n
payment_value = context.restrictedTraverse(payment)\n
payment_state = payment_value.getValidationState()\n
\n
if payment_state not in workflow_correct_state_list :\n
if not context.BankAcocunt_isOpened():\n
return {\'error_code\':2} # closed account\n
\n
resource = payment_value.getPriceCurrencyValue()\n
......@@ -156,7 +155,6 @@ return {\'error_code\':0, \'balance\':account_balance} # ok\n
<string>payment</string>
<string>quantity</string>
<string>src__</string>
<string>workflow_correct_state_list</string>
<string>manual_validation_account_category_list</string>
<string>_getattr_</string>
<string>context</string>
......
<?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>return context.getValidationState() in (\'valid\', \'being_modified\', \'validating_modification\')\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></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>_getattr_</string>
<string>context</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>BankAccount_isOpened</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
490
\ No newline at end of file
489
\ 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