[Erp5-report] r18965 - in /erp5/trunk/products/ERP5: Document/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Feb 1 11:28:42 CET 2008
Author: jerome
Date: Fri Feb 1 11:28:41 2008
New Revision: 18965
URL: http://svn.erp5.org?rev=18965&view=rev
Log:
enable full text search for accounting transactions
Modified:
erp5/trunk/products/ERP5/Document/AccountingTransaction.py
erp5/trunk/products/ERP5/tests/testAccounting.py
Modified: erp5/trunk/products/ERP5/Document/AccountingTransaction.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/AccountingTransaction.py?rev=18965&r1=18964&r2=18965&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/AccountingTransaction.py (original)
+++ erp5/trunk/products/ERP5/Document/AccountingTransaction.py Fri Feb 1 11:28:41 2008
@@ -97,6 +97,22 @@
return section.isMemberOf(preferred_section_category)
return 0
+ def SearchableText(self):
+ """Text for full text search"""
+ text_list = []
+ for prop in ( self.getTitle(),
+ self.getDescription(),
+ self.getComment(),
+ self.getReference(),
+ self.getSourceReference(),
+ self.getDestinationReference(),
+ self.getSourceSectionTitle(),
+ self.getDestinationSectionTitle(),
+ self.getStartDate(),
+ self.getStopDate(), ):
+ if prop:
+ text_list.append(prop)
+ return ' '.join(text_list)
# Compatibility
# It may be necessary to create an alias after removing the Transaction class
Modified: erp5/trunk/products/ERP5/tests/testAccounting.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccounting.py?rev=18965&r1=18964&r2=18965&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py Fri Feb 1 11:28:41 2008
@@ -2985,6 +2985,16 @@
self.assertEquals('2002-1', next_year_transaction.getSourceReference())
self.assertEquals('2002-1', next_year_transaction.getDestinationReference())
+ def test_SearchableText(self):
+ transaction = self.createAccountingTransaction(
+ title='A new Transaction',
+ description="A description",
+ comment="Some comments")
+ searchable_text = transaction.SearchableText()
+ self.assertTrue('A new Transaction' in searchable_text)
+ self.assertTrue('A description' in searchable_text)
+ self.assertTrue('Some comments' in searchable_text)
+
def test_suite():
suite = unittest.TestSuite()
More information about the Erp5-report
mailing list