[Erp5-report] r24223 - /erp5/trunk/products/ERP5/tests/testAccounting.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Oct 17 11:52:27 CEST 2008
Author: jerome
Date: Fri Oct 17 11:52:26 2008
New Revision: 24223
URL: http://svn.erp5.org?rev=24223&view=rev
Log:
reindex balance transaction with lines having same categories, when there is no previous inventory.
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=24223&r1=24222&r2=24223&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py Fri Oct 17 11:52:26 2008
@@ -1596,7 +1596,6 @@
section_uid=self.section.getUid(),
node_uid=node_uid))
-
def test_InventoryIndexingNodeDiffOnNode(self):
# Balance Transactions are indexed as Inventories.
transaction1 = self._makeOne(
@@ -1638,6 +1637,47 @@
node_uid = self.account_module.stocks.getUid()
self.assertEquals(-90, stool.getInventory(
section_uid=self.section.getUid(),
+ node_uid=node_uid))
+
+ def test_IndexingBalanceTransactionLinesWithSameNodes(self):
+ # Indexes balance transaction without any previous inventory.
+ # This make sure that indexing two balance transaction lines with same
+ # categories does not try to insert duplicate keys in category table.
+ balance = self.accounting_module.newContent(
+ portal_type='Balance Transaction',
+ destination_section_value=self.section,
+ start_date=DateTime(2006, 12, 31),
+ resource_value=self.currency_module.euro,)
+ balance.newContent(
+ portal_type='Balance Transaction Line',
+ source_section_value=self.organisation_module.client_1,
+ destination_value=self.account_module.receivable,
+ destination_debit=150,)
+ balance.newContent(
+ portal_type='Balance Transaction Line',
+ source_section_value=self.organisation_module.client_2,
+ destination_value=self.account_module.receivable,
+ destination_debit=30,)
+
+ balance.stop()
+ get_transaction().commit()
+ self.tic()
+
+ stool = self.portal.portal_simulation
+ # the account 'receivable' has a balance of 150 + 30
+ node_uid = self.account_module.receivable.getUid()
+ self.assertEquals(180, stool.getInventory(
+ section_uid=self.section.getUid(),
+ node_uid=node_uid))
+ self.assertEquals(150, stool.getInventory(
+ section_uid=self.section.getUid(),
+ mirror_section_uid=self.organisation_module\
+ .client_1.getUid(),
+ node_uid=node_uid))
+ self.assertEquals(30, stool.getInventory(
+ section_uid=self.section.getUid(),
+ mirror_section_uid=self.organisation_module\
+ .client_2.getUid(),
node_uid=node_uid))
More information about the Erp5-report
mailing list