From 13b3e4347c31ca3f12ebe5eaf25ec44e731ed19e Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Wed, 11 Apr 2007 09:13:12 +0000
Subject: [PATCH] Revert my previous change, thish code does not have to handle
 the case where the table has been recreated: a line must be inserted
 automaticaly at table creation.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14044 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/IdTool.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/product/ERP5/Tool/IdTool.py b/product/ERP5/Tool/IdTool.py
index 6fbcb6d1b2..10dd68f28f 100644
--- a/product/ERP5/Tool/IdTool.py
+++ b/product/ERP5/Tool/IdTool.py
@@ -192,11 +192,6 @@ class IdTool(UniqueObject, Folder):
       id_group = repr(id_group)
     if not isinstance(default, int):
       default = 1
-    if self.dict_length_ids.get(id_group) is None:
-      self.dict_length_ids[id_group] = Length()
-    # If the table has been flushed, the latest stored id must be used if
-    # it's greater than the default value.
-    default = max(default, self.dict_length_ids[id_group]())
     # FIXME: A skin folder should be used to contain ZSQLMethods instead of
     # default catalog, like activity tool (anyway, it uses activity tool
     # ZSQLConnection, so hot reindexing is not helping here).
@@ -212,6 +207,8 @@ class IdTool(UniqueObject, Folder):
     finally:
       commit()
     new_id = result[0]['LAST_INSERT_ID()']
+    if self.dict_length_ids.get(id_group) is None:
+      self.dict_length_ids[id_group] = Length(new_id)
     self.dict_length_ids[id_group].set(new_id)
     return range(new_id - id_count, new_id)
 
-- 
2.30.9