diff --git a/product/ERP5/Document/Alarm.py b/product/ERP5/Document/Alarm.py
index 1a5ac2294e7ce2c38f5078a9ceccc29e84cc88ce..038d4dcd8a42b13c474893d2918efcaba3d3bc75 100644
--- a/product/ERP5/Document/Alarm.py
+++ b/product/ERP5/Document/Alarm.py
@@ -303,7 +303,7 @@ class Alarm(XMLObject, PeriodicityMixin):
         # later when creating an active process for example
         # We do some inspection to keep compatibility
         # (because fixit and tag were not set previously)
-        tag = str(self.portal_ids.generateNewLengthId(id_group=self.getId()))
+        tag = str(self.portal_ids.generateNewId(id_generator='uid', id_group=self.getId()))
         method = getattr(self, method_id)
         func_code = method.func_code
         try:
diff --git a/product/ERP5/Document/BPMBuilder.py b/product/ERP5/Document/BPMBuilder.py
index 418b07210ee8e61451be9918b3394b0d872df9fd..c36cae4f9c6564b40e065abf761e0718258bc31f 100644
--- a/product/ERP5/Document/BPMBuilder.py
+++ b/product/ERP5/Document/BPMBuilder.py
@@ -136,7 +136,7 @@ class BPMBuilder(Alarm):
     # able to notify the user after all processes are ended
     # Tag is generated from portal_ids so that it can be retrieved
     # later when creating an active process for example
-    tag = str(self.portal_ids.generateNewLengthId(id_group=self.getId()))
+    tag = str(self.portal_ids.generateNewId(id_generator='uid', id_group=self.getId()))
     self.activate(tag=tag).build(tag=tag)
 
     if self.isAlarmNotificationMode():
diff --git a/product/ERP5/tests/testAccounting.py b/product/ERP5/tests/testAccounting.py
index 97776eee066247ed85af8f655ae7f84d6c57dc46..31c91dfbf86d00044d34a09d742f4e81dec45c61 100644
--- a/product/ERP5/tests/testAccounting.py
+++ b/product/ERP5/tests/testAccounting.py
@@ -2092,13 +2092,7 @@ class TestTransactions(AccountingTestCase):
   """
   def _resetIdGenerator(self):
     # clear all existing ids in portal ids
-    if hasattr(self.portal.portal_ids, 'dict_ids'):
-      self.portal.portal_ids.dict_ids.clear()
-    if hasattr(self.portal.portal_ids, 'dict_length_ids'):
-      self.portal.portal_ids.dict_length_ids.clear()
-      self.portal.erp5_sql_transactionless_connection.manage_test(
-        """DELETE FROM portal_ids WHERE id_group LIKE '%accounting%'""")
-      self.portal.portal_catalog.getSQLCatalog().z_portal_ids_commit()
+      self.portal.portal_ids.clearGenerator(all=True)
   
   def test_SourceDestinationReference(self):
     # Check that source reference and destination reference are filled
diff --git a/product/ERP5/tests/testAdvancedInvoicing.py b/product/ERP5/tests/testAdvancedInvoicing.py
index 28f5373f49454e1d998fed97eb7a24d7d966f3be..deba9bb5962042881a10a6144fe9cddea0a3e6b7 100644
--- a/product/ERP5/tests/testAdvancedInvoicing.py
+++ b/product/ERP5/tests/testAdvancedInvoicing.py
@@ -393,7 +393,7 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice):
 
   def afterSetUp(self):
     super(TestAdvancedSaleInvoice, self).afterSetUp()
-    self.portal.portal_ids.setLastGeneratedId(0, id_group='Accounting_Transaction_Module-Sale_Invoice_Transaction')
+    self.portal.portal_ids.clearGenerator(all=True)
 
   def stepCheckInvoicesAndTransactionsConsistency(self, sequence=None, sequence_list=None,
                                                   **kw):