[Erp5-report] r13450 - in /erp5/trunk/products/ERP5: Document/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 16 11:01:05 CET 2007


Author: seb
Date: Fri Mar 16 11:00:57 2007
New Revision: 13450

URL: http://svn.erp5.org?rev=13450&view=rev
Log:
remove manage_beforeDelete into AccountingTransaction, we can now configure when we want to delete with the delete_action workflow transition

Modified:
    erp5/trunk/products/ERP5/Document/AccountingTransaction.py
    erp5/trunk/products/ERP5/tests/testAccounting.py
    erp5/trunk/products/ERP5/tests/testImmobilisation.py

Modified: erp5/trunk/products/ERP5/Document/AccountingTransaction.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/AccountingTransaction.py?rev=13450&r1=13449&r2=13450&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/AccountingTransaction.py (original)
+++ erp5/trunk/products/ERP5/Document/AccountingTransaction.py Fri Mar 16 11:00:57 2007
@@ -27,7 +27,6 @@
 ##############################################################################
 
 from Globals import InitializeClass
-from Globals import DevelopmentMode
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
 from Products.CMFCore.utils import getToolByName
@@ -66,18 +65,6 @@
                       , PropertySheet.PaymentCondition
                       )
 
-    def manage_beforeDelete(self, item, container):
-      """
-          Accounting transactions can only be deleted 
-          in draft or cancelled state
-      """
-      if not DevelopmentMode:
-        if self.getSimulationState() not in ("draft", "cancelled"):
-          from OFS.ObjectManager import BeforeDeleteException
-          raise BeforeDeleteException, \
-              "%s can only be deleted in draft or cancelled states." % self.getPortalType()
-      Delivery.manage_beforeDelete(self, item, container)
-
 # Compatibility
 # It may be necessary to create an alias after removing the Transaction class
 # Products.ERP5Type.Document.Transaction = AccountingTransaction

Modified: erp5/trunk/products/ERP5/tests/testAccounting.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccounting.py?rev=13450&r1=13449&r2=13450&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py Fri Mar 16 11:00:57 2007
@@ -184,7 +184,6 @@
     """Remove all documents, except the default ones.
     """
     get_transaction().abort()
-    allowAccountingTransactionDeletion()
     self.accounting_module.manage_delObjects(
                       list(self.accounting_module.objectIds()))
     self.organisation_module.manage_delObjects([x for x in 
@@ -215,24 +214,6 @@
             'erp5_accounting_ui_test')
 
 
-def manage_beforeDelete(self, item, container):
-  Delivery.manage_beforeDelete(self, item, container)
-
-def allowAccountingTransactionDeletion():
-  from Products.ERP5.Document.AccountingTransaction \
-      import AccountingTransaction
-  old_manage_beforeDelete = AccountingTransaction.manage_beforeDelete 
-  AccountingTransaction.manage_beforeDelete = manage_beforeDelete
-  try:
-    from Products.ERP5Type.Document.AccountingTransaction \
-        import AccountingTransaction
-    AccountingTransaction.manage_beforeDelete = manage_beforeDelete
-  except ImportError:
-    # ERP5Type version of this class is only available when ERP5Type document
-    # registry has been initialized.
-    pass
-
-
 class TestAccounting(ERP5TypeTestCase):
   """The first test for Accounting
   """
@@ -300,7 +281,6 @@
     All tests uses the same accounts and same entities, so we just cleanup
     accounting module and simulation. """
     get_transaction().abort()
-    allowAccountingTransactionDeletion()
     for folder in (self.accounting_module, self.portal.portal_simulation):
       folder.manage_delObjects([i for i in folder.objectIds()])
     get_transaction().commit()

Modified: erp5/trunk/products/ERP5/tests/testImmobilisation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testImmobilisation.py?rev=13450&r1=13449&r2=13450&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testImmobilisation.py (original)
+++ erp5/trunk/products/ERP5/tests/testImmobilisation.py Fri Mar 16 11:00:57 2007
@@ -276,12 +276,8 @@
     pl_id_list = [r for r in self.getPortal().purchase_packing_list_module.objectIds()]
     self.getPortal().purchase_packing_list_module.manage_delObjects(pl_id_list)
 
-    transaction_id_list = []
-    for transaction in self.getAccountingModule().objectValues():
-      transaction_id_list.append(transaction.getId())
-      transaction.workflow_history = {}
-      
-    self.getAccountingModule().manage_delObjects(item_id_list)
+    id_list = [r for r in self.getAccountingModule().objectIds()]
+    self.getAccountingModule().manage_delObjects(id_list)
     
     get_transaction().commit()
     self.tic()




More information about the Erp5-report mailing list