diff --git a/product/ERP5/tests/testAccounting.py b/product/ERP5/tests/testAccounting.py index fa1f46f0c6afc78a8dcd099b368e05f99e9a7ccb..19e458b01b59feeee82cc185c89a9a60d8d3108c 100644 --- a/product/ERP5/tests/testAccounting.py +++ b/product/ERP5/tests/testAccounting.py @@ -2833,11 +2833,23 @@ class TestAccountingWithSequences(AccountingTestCase): def beforeTearDown(self): """Cleanup for next test. - All tests uses the same accounts and same entities, so we just cleanup - accounting module and simulation. """ + """ transaction.abort() for folder in (self.accounting_module, self.portal.portal_simulation): folder.manage_delObjects([i for i in folder.objectIds()]) + + # Some tests commits transaction, some other does not, so accounts and + # organisations created in this tests will not always be present at this + # point + folder = self.portal.account_module + for account in self.account_list: + if account.getId() in folder.objectIds(): + folder.manage_delObjects([account.getId()]) + folder = self.portal.organisation_module + for entity in (self.client, self.vendor, self.other_vendor): + if entity.getId() in folder.objectIds(): + folder.manage_delObjects([entity.getId()]) + transaction.commit() self.tic()