[Erp5-report] r36498 jerome - in /erp5/trunk/products/ERP5: Document/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Jun 22 10:50:58 CEST 2010
Author: jerome
Date: Tue Jun 22 10:50:52 2010
New Revision: 36498
URL: http://svn.erp5.org?rev=36498&view=rev
Log:
Fix unindexing of balance transaction:
- make balance transaction line indexable
- pass all archive related parameters during delta indexation
- stop cleaning up manually in tear down
Modified:
erp5/trunk/products/ERP5/Document/BalanceTransaction.py
erp5/trunk/products/ERP5/Document/BalanceTransactionLine.py
erp5/trunk/products/ERP5/tests/testAccounting.py
erp5/trunk/products/ERP5/tests/testAccountingReports.py
Modified: erp5/trunk/products/ERP5/Document/BalanceTransaction.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BalanceTransaction.py?rev=36498&r1=36497&r2=36498&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BalanceTransaction.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BalanceTransaction.py [utf8] Tue Jun 22 10:50:52 2010
@@ -404,11 +404,11 @@ class BalanceTransaction(AccountingTrans
This method must return a function that accepts properties keywords
arguments and returns a temp object edited with those properties.
"""
- from Products.ERP5Type.Document import newTempBalanceTransactionLine
-
+ from Products.ERP5Type.Document import newTempAccountingTransactionLine
def factory(*args, **kw):
- doc = newTempBalanceTransactionLine(self, kw.pop('id', self.getId()),
- uid=self.getUid())
+ doc = newTempAccountingTransactionLine(self, kw.pop('id', self.getId()),
+ uid=self.getUid())
+ doc.portal_type = 'Balance Transaction Line'
relative_url = kw.pop('relative_url', None)
destination_total_asset_price = kw.pop('total_price', None)
if destination_total_asset_price is not None:
@@ -459,16 +459,15 @@ class BalanceTransaction(AccountingTrans
"""
sql_catalog_id = kw.pop("sql_catalog_id", None)
disable_archive = kw.pop("disable_archive", 0)
+ immediate_reindex_archive = sql_catalog_id is not None
if self.getSimulationState() in self.getPortalDraftOrderStateList() + (
'deleted',):
# this prevent from trying to calculate stock
# with not all properties defined and thus making
# request with no condition in mysql
- object_list = [self]
- immediate_reindex_archive = sql_catalog_id is not None
self.portal_catalog.catalogObjectList(
- object_list,
+ [self],
sql_catalog_id = sql_catalog_id,
disable_archive=disable_archive,
immediate_reindex_archive=immediate_reindex_archive)
@@ -489,9 +488,9 @@ class BalanceTransaction(AccountingTrans
self.portal_catalog.catalogObjectList([self])
# Catalog differences calculated from lines
- self.portal_catalog.catalogObjectList(stock_object_list,
- method_id_list=('z_catalog_stock_list',
- 'z_catalog_object_list',
- 'z_catalog_movement_category_list'),
- disable_cache=1, check_uid=0)
-
+ self.portal_catalog.catalogObjectList(stock_object_list[::],
+ method_id_list=('z_catalog_stock_list',),
+ disable_cache=1, check_uid=0,
+ sql_catalog_id=sql_catalog_id,
+ disable_archive=disable_archive,
+ immediate_reindex_archive=immediate_reindex_archive)
Modified: erp5/trunk/products/ERP5/Document/BalanceTransactionLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BalanceTransactionLine.py?rev=36498&r1=36497&r2=36498&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BalanceTransactionLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BalanceTransactionLine.py [utf8] Tue Jun 22 10:50:52 2010
@@ -43,7 +43,7 @@ class BalanceTransactionLine(AccountingT
meta_type = 'ERP5 Balance Transaction Line'
portal_type = 'Balance Transaction Line'
add_permission = Permissions.AddPortalContent
- isIndexable = ConstantGetter('isIndexable', value=False)
+ isInventoryMovement = ConstantGetter('isInventoryMovement', value=True)
# Declarative security
security = ClassSecurityInfo()
Modified: erp5/trunk/products/ERP5/tests/testAccounting.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccounting.py?rev=36498&r1=36497&r2=36498&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py [utf8] Tue Jun 22 10:50:52 2010
@@ -863,14 +863,6 @@ class TestTransactionValidation(Accounti
class TestClosingPeriod(AccountingTestCase):
"""Various tests for closing the period.
"""
- def beforeTearDown(self):
- transaction.abort()
- # we manually remove the content of stock table, because unindexObject
- # might not work correctly on Balance Transaction, and we don't want
- # leave something in stock table that will change the next test.
- self.portal.erp5_sql_connection.manage_test('truncate stock')
- transaction.commit()
-
def test_createBalanceOnNode(self):
period = self.section.newContent(portal_type='Accounting Period')
period.setStartDate(DateTime(2006, 1, 1))
@@ -1781,7 +1773,8 @@ class TestClosingPeriod(AccountingTestCa
destination_credit=100,)
balance.stop()
balance.deliver()
- balance.immediateReindexObject()
+ transaction.commit()
+ self.tic()
# now check inventory
stool = self.getSimulationTool()
@@ -1818,6 +1811,11 @@ class TestClosingPeriod(AccountingTestCa
balance.reindexObject()
transaction.commit()
self.tic()
+ # the account 'receivable' still has a balance of 100
+ node_uid = self.account_module.receivable.getUid()
+ self.assertEquals(100, stool.getInventory(
+ section_uid=self.section.getUid(),
+ node_uid=node_uid))
def test_InventoryIndexingNodeDiffOnNode(self):
# Balance Transactions are indexed as Inventories.
Modified: erp5/trunk/products/ERP5/tests/testAccountingReports.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccountingReports.py?rev=36498&r1=36497&r2=36498&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccountingReports.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAccountingReports.py [utf8] Tue Jun 22 10:50:52 2010
@@ -52,12 +52,6 @@ class TestAccountingReports(AccountingTe
...
"""
- def beforeTearDown(self):
- # workaround the fact that Balance Transaction Line are not unindexed
- # correctly when removed
- self.portal.erp5_sql_connection.manage_test('TRUNCATE TABLE stock')
- transaction.commit()
-
def testJournal(self):
# Journal report.
# this will be a journal for 2006/02/02, for Sale Invoice Transaction
More information about the Erp5-report
mailing list