diff --git a/product/ERP5/Document/AccountingTransaction.py b/product/ERP5/Document/AccountingTransaction.py index 886df84cbd3baa816cd2be5f81eb748df9293759..c9ae251d2389e56efb704f9e378283943932be2d 100644 --- a/product/ERP5/Document/AccountingTransaction.py +++ b/product/ERP5/Document/AccountingTransaction.py @@ -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 @@ class AccountingTransaction(Delivery): , 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 diff --git a/product/ERP5/tests/testAccounting.py b/product/ERP5/tests/testAccounting.py index c2c15a50af629a000e7ffb4883e46267f6ff7145..d3d69091464b1fd39c6baef93fc26c9c8354642b 100644 --- a/product/ERP5/tests/testAccounting.py +++ b/product/ERP5/tests/testAccounting.py @@ -184,7 +184,6 @@ class AccountingTestCase(ERP5TypeTestCase): """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 @@ class AccountingTestCase(ERP5TypeTestCase): '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 @@ class TestAccounting(ERP5TypeTestCase): 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() diff --git a/product/ERP5/tests/testImmobilisation.py b/product/ERP5/tests/testImmobilisation.py index a58b118b4e8e76ea6c7b2a5d3f5afd1b8e242674..660ea07cf3683006c05dbee46c3a3938e30bb7bc 100644 --- a/product/ERP5/tests/testImmobilisation.py +++ b/product/ERP5/tests/testImmobilisation.py @@ -276,12 +276,8 @@ class TestImmobilisationMixin(TestOrderMixin, ERP5TypeTestCase): 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()