[FIX] base : Partner Addresses Menu now being translated
[odoo/odoo.git] / bin / pooler.py
index 60ea806..75625f1 100644 (file)
@@ -1,8 +1,8 @@
 # -*- encoding: utf-8 -*-
 ##############################################################################
 #
-#    OpenERP, Open Source Management Solution  
-#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 #    $Id$
 #
 #    This program is free software: you can redistribute it and/or modify
@@ -25,7 +25,7 @@ pool_dic = {}
 def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False):
     if not status:
         status={}
+
     db = get_db_only(db_name)
 
     if db_name in pool_dic:
@@ -35,7 +35,13 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False)
         import osv.osv
         pool = osv.osv.osv_pool()
         pool_dic[db_name] = pool
-        addons.load_modules(db, force_demo, status, update_module)
+
+        try:
+            addons.load_modules(db, force_demo, status, update_module)
+        except Exception:
+            del pool_dic[db_name]
+            raise
+
         cr = db.cursor()
         try:
             pool.init_set(cr, False)
@@ -45,7 +51,7 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False)
 
         import report
         report.interface.register_all(db)
-        pool.get('ir.cron')._poolJobs(db.dbname)
+        pool.get('ir.cron').restart(db.dbname)
     return db, pool