From e2359ea22c6dcd3a3e9e2ce7ba9603ed9989ed7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dani=C3=A8le=20Vanbaelinghem?= <daniele@nexedi.com>
Date: Wed, 14 Apr 2010 19:44:54 +0000
Subject: [PATCH] Fix the code for the compatibility after the changement of
 IdTool_zGetLastId

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

diff --git a/product/ERP5/Tool/IdTool.py b/product/ERP5/Tool/IdTool.py
index 6dd14f66c1..d3869d668d 100644
--- a/product/ERP5/Tool/IdTool.py
+++ b/product/ERP5/Tool/IdTool.py
@@ -322,7 +322,10 @@ class IdTool(BaseTool):
             'be found.'
     result = query(id_group=id_group)
     if len(result):
-      return result[0]['last_id'] - 1
+      try:
+        return result[0]['last_id']
+      except KeyError:
+        return result[0]['LAST_INSERT_ID()']
     return default
 
   #use in erp5_accounting
-- 
2.30.9