[IMP] fix import

bzr revid: al@openerp.com-20111024224055-6t5kamjz92h81fb6
This commit is contained in:
Antony Lesuisse 2011-10-25 00:40:55 +02:00
parent 1ab22b86cc
commit d86d2c085e
1 changed files with 9 additions and 32 deletions

View File

@ -58,45 +58,22 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({
this.template = "EdiEmpty";
},
start: function() {
console.log("import valid",this.url);
this.session.on_session_valid.add_last(self.do_import);
this.session.on_session_valid.add_last(this.do_import);
// TODO if session invalid ask for login
this.session.start();
},
do_import: function() {
console.log("import okokoko",this.url);
this.rpc('/edi/import_edi_url', {"url": this.url}, this.on_imported, this.on_imported_error);
},
on_imported: function(response){
$('<div>Import successful, click Ok to see the new document</div>').dialog({
modal: true,
title: 'Successful',
buttons: {
Ok: function() {
$(this).dialog("close");
// var action = {
// "res_model": response[0][0],
// "res_id": parseInt(response[0][1], 10),
// "views":[[false,"form"]],
// "type":"ir.actions.act_window",
// "view_type":"form",
// "view_mode":"form"
// }
// action.flags = {
// search_view: false,
// sidebar : false,
// views_switcher : false,
// action_buttons : false,
// pager: false
// }
// var action_manager = new openerp.web.ActionManager(self);
// action_manager.appendTo($("#oe_app"));
// action_manager.start();
// action_manager.do_action(action);
}
}
});
on_imported: function(response) {
console.log("responde from import",response);
// response is null when exception
// model: response[0][0],
// id: parseInt(response[0][1], 10),
window.location = "/web/webclient/home?debug=1#model=MODEL&id=ID";
},
on_imported_error: function(response){
var self = this;
$(openerp.web.qweb.render("DialogWarning", "Sorry, Import is not successful.")).dialog({
modal: true,
buttons: {