Commit 05b35969 authored by Jérome Perrin's avatar Jérome Perrin

more tests for debit == credit validation with potential rounding issues



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17388 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 62f9354b
......@@ -359,6 +359,53 @@ class TestTransactionValidation(AccountingTestCase):
transaction.setSourcePaymentValue(bank_account)
self.portal.portal_workflow.doActionFor(transaction, 'stop_action')
def test_NonBalancedAccountingTransaction(self):
# Accounting Transactions have to be balanced to be validated
transaction = self._makeOne(
portal_type='Accounting Transaction',
start_date=DateTime('2007/01/02'),
destination_section_value=self.organisation_module.client_1,
resource='currency_module/yen',
lines=(dict(source_value=self.account_module.payable,
source_asset_debit=39,
source_debit=500),
dict(source_value=self.account_module.receivable,
source_asset_credit=38.99,
source_credit=500)))
# refused because not balanced
self.assertRaises(ValidationFailed,
self.portal.portal_workflow.doActionFor,
transaction, 'stop_action')
for line in transaction.getMovementList():
if line.getSourceId() == 'payable':
line.setSourceAssetDebit(38.99)
self.portal.portal_workflow.doActionFor(transaction, 'stop_action')
def test_NonBalancedDestinationAccountingTransaction(self):
# Accounting Transactions have to be balanced to be validated,
# also for destination
transaction = self._makeOne(
portal_type='Accounting Transaction',
start_date=DateTime('2007/01/02'),
destination_section_value=self.organisation_module.client_1,
resource='currency_module/yen',
lines=(dict(source_value=self.account_module.payable,
destination_value=self.account_module.receivable,
destination_asset_debit=39,
source_debit=500),
dict(source_value=self.account_module.receivable,
destination_value=self.account_module.payable,
destination_asset_credit=38.99,
source_credit=500)))
# refused because not balanced
self.assertRaises(ValidationFailed,
self.portal.portal_workflow.doActionFor,
transaction, 'stop_action')
for line in transaction.getMovementList():
if line.getDestinationId() == 'receivable':
line.setDestinationAssetDebit(38.99)
self.portal.portal_workflow.doActionFor(transaction, 'stop_action')
class TestClosingPeriod(AccountingTestCase):
"""Various tests for closing the period.
......
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