diff --git a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkBalance.xml b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkBalance.xml index 196584262a04539c162b4de983230a506d9bd00e..7bb951022e06b7d50a4d88915cacbad771180d6b 100644 --- a/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkBalance.xml +++ b/bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/BankAccount_checkBalance.xml @@ -59,26 +59,37 @@ payment_value = context.restrictedTraverse(payment)\n \n if not payment_value.BankAccount_isOpened():\n - return {\'error_code\':2} # closed account\n + return {\'error_code\': 2} # closed account\n \n account_balance = payment_value.BankAccount_getAvailablePosition(src__=src__)\n if src__:\n return account_balance\n # XXX: BankAccount_getAvailablePosition returns position as a string for some reason...\n -account_balance = float(account_balance)\n +raw_account_balance = account_balance = float(account_balance)\n +if round_balance:\n + account_balance = round(account_balance, resource.getQuantityPrecision())\n \n -if account_balance - quantity < 0 :\n - return {\'error_code\':1, \'balance\':account_balance} # insufficient balance\n +if account_balance - quantity < 0:\n + # insufficient balance\n + return {\n + \'error_code\': 1,\n + \'balance\': account_balance,\n + \'raw_balance\': raw_account_balance,\n + }\n \n payment_value.serialize()\n -return {\'error_code\':0, \'balance\':account_balance} # ok\n +return {\n + \'error_code\': 0,\n + \'balance\': account_balance,\n + \'raw_balance\': raw_account_balance,\n +}\n ]]></string> </value> </item> <item> <key> <string>_params</string> </key> - <value> <string>payment, quantity, src__=0</string> </value> + <value> <string>payment, quantity, round_balance=True, src__=0</string> </value> </item> <item> <key> <string>_proxy_roles</string> </key> diff --git a/bt5/erp5_banking_core/bt/revision b/bt5/erp5_banking_core/bt/revision index 8f7277e735d3ee0a2a136d56ee6e41a4b289b125..23c5f49dce2fe2fe524cf1f2e227fe5b42560b10 100644 --- a/bt5/erp5_banking_core/bt/revision +++ b/bt5/erp5_banking_core/bt/revision @@ -1 +1 @@ -571 \ No newline at end of file +572 \ No newline at end of file