[Erp5-report] r17388 - /erp5/trunk/products/ERP5/tests/testAccounting.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Nov 5 16:46:15 CET 2007
Author: jerome
Date: Mon Nov 5 16:46:13 2007
New Revision: 17388
URL: http://svn.erp5.org?rev=17388&view=rev
Log:
more tests for debit == credit validation with potential rounding issues
Modified:
erp5/trunk/products/ERP5/tests/testAccounting.py
Modified: erp5/trunk/products/ERP5/tests/testAccounting.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccounting.py?rev=17388&r1=17387&r2=17388&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py Mon Nov 5 16:46:13 2007
@@ -357,6 +357,53 @@
# with bank account, it's OK
bank_account = self.section.newContent(portal_type='Bank Account')
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')
More information about the Erp5-report
mailing list