Commit 5acf7cb3 authored by Jérome Perrin's avatar Jérome Perrin

reindex balance transaction with lines having same categories, when there is no previous inventory.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24223 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e7b36643
......@@ -1596,7 +1596,6 @@ class TestClosingPeriod(AccountingTestCase):
section_uid=self.section.getUid(),
node_uid=node_uid))
def test_InventoryIndexingNodeDiffOnNode(self):
# Balance Transactions are indexed as Inventories.
transaction1 = self._makeOne(
......@@ -1640,6 +1639,47 @@ class TestClosingPeriod(AccountingTestCase):
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))
def test_BalanceTransactionLineBrainGetObject(self):
# Balance Transaction Line can be retrieved using Brain.getObject
......
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