Antony Lesuisse (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-edi-chs into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-edi-chs/+merge/90949

edi login
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-edi-chs/+merge/90949
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-edi-chs.
=== modified file 'edi/models/edi.py'
--- edi/models/edi.py	2011-12-20 14:41:31 +0000
+++ edi/models/edi.py	2012-01-31 20:50:36 +0000
@@ -2,7 +2,7 @@
 ##############################################################################
 #
 #    OpenERP, Open Source Business Applications
-#    Copyright (c) 2011 OpenERP S.A. <http://openerp.com>
+#    Copyright (c) 2011-2012 OpenERP S.A. <http://openerp.com>
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -37,7 +37,7 @@
 from tools.safe_eval import safe_eval as eval
 
 EXTERNAL_ID_PATTERN = re.compile(r'^([^.:]+)(?::([^.]+))?\.(\S+)$')
-EDI_VIEW_WEB_URL = '%s/edi/view?debug=1&db=%s&token=%s'
+EDI_VIEW_WEB_URL = '%s/edi/view?db=%s&token=%s'
 EDI_PROTOCOL_VERSION = 1 # arbitrary ever-increasing version number
 EDI_GENERATOR = 'OpenERP ' + release.major_version
 EDI_GENERATOR_VERSION = release.version_info
@@ -682,4 +682,4 @@
 
         return record_id
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'edi/static/src/js/edi.js'
--- edi/static/src/js/edi.js	2012-01-27 04:43:26 +0000
+++ edi/static/src/js/edi.js	2012-01-31 20:50:36 +0000
@@ -109,35 +109,60 @@
 
 openerp.edi.edi_view = function (db, token) {
     openerp.connection.bind().then(function () {
-        new openerp.edi.EdiView(null,db,token).appendTo($("body"));
+        new openerp.edi.EdiView(null,db,token).appendTo($("body").addClass('openerp'));
     });
 }
 
+<<<<<<< TREE
 openerp.edi.EdiImport = openerp.web.OldWidget.extend({
     init: function(parent,url) {
         this._super();
+=======
+openerp.edi.EdiImport = openerp.web.Widget.extend({
+    template: "EdiImport",
+
+    init: function(parent, url) {
+        this._super(parent);
+>>>>>>> MERGE-SOURCE
         this.url = url;
-        var params = {};
-
-        this.template = "EdiImport";
-        this.session = openerp.connection;
+    },
+    start: function() {
+        if (!this.session.session_is_valid()) {
+            this.show_login();
+            this.session.on_session_valid.add({
+                callback: this.proxy('show_import'),
+                unique: true,
+            });
+        } else {
+            this.show_import();
+        }
+    },
+
+    show_import: function() {
+        this.destroy_content();
+        this.do_import();
+    },
+
+    show_login: function() {
+        this.destroy_content();
         this.login = new openerp.web.Login(this);
-        this.header = new openerp.web.Header(this);
-    },
-    start: function() {
-        // TODO fix by explicitly asking login if needed
-        //this.session.on_session_invalid.add_last(this.do_ask_login);
-        this.header.appendTo($("#oe_header"));
-        this.login.appendTo($('#oe_login'));
-        this.do_import();
-    },
+        this.login.appendTo(this.$element);
+    },
+
+    destroy_content: function() {
+        _.each(_.clone(this.widget_children), function(el) {
+            el.stop();
+        });
+        this.$element.children().remove();
+    },
+
     do_import: function() {
         this.rpc('/edi/import_edi_url', {url: this.url}, this.on_imported, this.on_imported_error);
     },
     on_imported: function(response) {
         if ('action' in response) {
             this.rpc("/web/session/save_session_action", {the_action: response.action}, function(key) {
-                window.location = "/web/webclient/home?debug=1&s_action="+encodeURIComponent(key);
+                window.location = "/web/webclient/home#sa="+encodeURIComponent(key);
             });
         }
         else {
@@ -147,7 +172,7 @@
                 buttons: {
                     Ok: function() {
                         $(this).dialog("close");
-                        window.location = "/web/webclient/home";
+                        window.location = "/";
                     }
                 }
             }).html('The document has been successfully imported!');
@@ -172,7 +197,7 @@
 
 openerp.edi.edi_import = function (url) {
     openerp.connection.bind().then(function () {
-        new openerp.edi.EdiImport(null,url).appendTo($("body"));
+        new openerp.edi.EdiImport(null,url).appendTo($("body").addClass('openerp'));
     });
 }
 

_______________________________________________
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