Vo Minh Thu (OpenERP) has proposed merging 
lp:~openerp-dev/openerp-web/trunk-create-db-vmt into lp:openerp-web.

Requested reviews:
  OpenERP R&D Web Team (openerp-dev-web)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-create-db-vmt/+merge/96352

Similar to 
https://code.launchpad.net/~openerp-dev/openerp-web/6.1-blocking-create-db-vmt/+merge/96351
 on the 6.1 branch.
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-create-db-vmt/+merge/96352
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openerp-web/trunk-create-db-vmt.
=== modified file 'addons/web/controllers/main.py'
--- addons/web/controllers/main.py	2012-03-05 07:06:34 +0000
+++ addons/web/controllers/main.py	2012-03-07 13:10:44 +0000
@@ -410,11 +410,7 @@
         return {"db_list": dbs}
 
     @openerpweb.jsonrequest
-    def progress(self, req, password, id):
-        return req.session.proxy('db').get_progress(password, id)
-
-    @openerpweb.jsonrequest
-    def create(self, req, fields):
+    def create_database(self, req, fields):
 
         params = dict(map(operator.itemgetter('name', 'value'), fields))
         create_attrs = (
@@ -426,7 +422,7 @@
         )
 
         try:
-            return req.session.proxy("db").create(*create_attrs)
+            return req.session.proxy("db").create_database(*create_attrs)
         except xmlrpclib.Fault, e:
             if e.faultCode and isinstance(e.faultCode, str)\
                 and e.faultCode.split(':')[0] == 'AccessDenied':

=== modified file 'addons/web/static/src/js/chrome.js'
--- addons/web/static/src/js/chrome.js	2012-03-06 11:02:12 +0000
+++ addons/web/static/src/js/chrome.js	2012-03-07 13:10:44 +0000
@@ -351,44 +351,6 @@
         return result;
     },
     /**
-     * Waits until the new database is done creating, then unblocks the UI and
-     * logs the user in as admin
-     *
-     * @param {Number} db_creation_id identifier for the db-creation operation, used to fetch the current installation progress
-     * @param {Object} info info fields for this database creation
-     * @param {String} info.db name of the database being created
-     * @param {String} info.password super-admin password for the database
-     */
-    wait_for_newdb: function (db_creation_id, info) {
-        var self = this;
-        self.rpc('/web/database/progress', {
-            id: db_creation_id,
-            password: info.password
-        }, function (result) {
-            var progress = result[0];
-            // I'd display a progress bar, but turns out the progress status
-            // the server report kind-of blows goats: it's at 0 for ~75% of
-            // the installation, then jumps to 75%, then jumps down to either
-            // 0 or ~40%, then back up to 75%, then terminates. Let's keep that
-            // mess hidden behind a not-very-useful but not overly weird
-            // message instead.
-            if (progress < 1) {
-                setTimeout(function () {
-                    self.wait_for_newdb(db_creation_id, info);
-                }, 500);
-                return;
-            }
-
-            var admin = result[1][0];
-            setTimeout(function () {
-                self.getParent().do_login(
-                        info.db, admin.login, admin.password);
-                self.destroy();
-                self.unblockUI();
-            });
-        });
-    },
-    /**
      * Blocks UI and replaces $.unblockUI by a noop to prevent third parties
      * from unblocking the UI
      */
@@ -428,7 +390,7 @@
             submitHandler: function (form) {
                 var fields = $(form).serializeArray();
                 self.blockUI();
-                self.rpc("/web/database/create", {'fields': fields}, function(result) {
+                self.rpc("/web/database/create_database", {'fields': fields}, function(result) {
                     if (result.error) {
                         self.unblockUI();
                         self.display_error(result);
@@ -439,11 +401,14 @@
                         self.db_list.sort();
                         self.getParent().set_db_list(self.db_list);
                     }
+
                     var form_obj = self.to_object(fields);
-                    self.wait_for_newdb(result, {
-                        password: form_obj['super_admin_pwd'],
-                        db: form_obj['db_name']
-                    });
+                    self.getParent().do_login(
+                            form_obj['db_name'],
+                            'admin',
+                            form_obj['create_admin_pwd']);
+                    self.destroy();
+                    self.unblockUI();
                 });
             }
         });

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to