From da378722cc3f64aec01252caa2017e1024fa87d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 27 May 2015 13:46:26 +0200 Subject: [PATCH] Revert "[IMP] web, point_of_sale: basic implementation of the cordova integration." This reverts commit f7a1ac8b0696ec7e61f3ef394983ec8713da2274. The commit introduced a change that required a database update, which should not be required in a stable version. --- addons/point_of_sale/static/src/js/widgets.js | 4 - addons/web/static/src/js/chrome.js | 6 -- addons/web/static/src/js/cordova.js | 78 ------------------- addons/web/views/webclient_templates.xml | 1 - 4 files changed, 89 deletions(-) delete mode 100644 addons/web/static/src/js/cordova.js diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index bf33b502754..6aaf7329446 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -972,7 +972,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa $('.oe_web_client').off(); $('.openerp_webclient_container').off(); - self.renderElement(); self.$('.neworder-button').click(function(){ @@ -1018,8 +1017,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa instance.webclient.set_content_full_screen(true); self.$('.loader').animate({opacity:0},1500,'swing',function(){self.$('.loader').addClass('oe_hidden');}); - - instance.web.cordova.posready(); self.pos.push_order(); @@ -1234,7 +1231,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa function close(){ self.pos.push_order().then(function(){ - instance.web.cordova.poslogout(); return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_client_pos_menu']], ['res_id']).pipe(function(res) { window.location = '/web#action=' + res[0]['res_id']; },function(err,event) { diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 07b756d991a..0a35bfd1244 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1202,7 +1202,6 @@ instance.web.WebClient = instance.web.Client.extend({ this.on("change:title_part", this, this._title_changed); this._title_changed(); - return $.when(this._super()).then(function() { if (jQuery.deparam !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined) { self.to_kitten(); @@ -1214,10 +1213,6 @@ instance.web.WebClient = instance.web.Client.extend({ self.action_manager.do_action(self.client_options.action); delete(self.client_options.action); } - instance.web.cordova.ready(); - instance.web.cordova.on('back', self, function() { - self.do_action('history_back'); - }); }); }, to_kitten: function() { @@ -1373,7 +1368,6 @@ instance.web.WebClient = instance.web.Client.extend({ on_logout: function() { var self = this; if (!this.has_uncommitted_changes()) { - instance.web.cordova.logout(); self.action_manager.do_action('logout'); } }, diff --git a/addons/web/static/src/js/cordova.js b/addons/web/static/src/js/cordova.js deleted file mode 100644 index b907d04c8a8..00000000000 --- a/addons/web/static/src/js/cordova.js +++ /dev/null @@ -1,78 +0,0 @@ -(function() { -"use strict"; - -var instance = openerp; -var Class = instance.web.Class; - -// The Android/iPhone App is a JS/HTML app that launches the -// Odoo webclient in an iframe, using the Cordova framework. -// -// This class acts as a link between the webclient and the -// Odoo Android/iPhone App implemented with cordova. - -instance.web.Cordova = Class.extend({}, instance.web.PropertiesMixin, { - init: function(parent) { - var self = this; - instance.web.PropertiesMixin.init.call(this, parent); - - window.addEventListener('message', function(event) { - self.receive(event); - }, false); - - }, - // odoo.send('foobar') in cordova will call messages.foobar() - messages: { - // launch the POS ! - pos: function() { - if (window.location.href.indexOf('/pos/web') < 0) { - window.location.href = "/pos/web"; - } - }, - }, - // what happens when we receive an event from cordova - // -> call messages[event.data]() - // -> selfs trigger(event.data) - receive: function(event) { - if (event.origin !== 'file://') { - return; - } - - if (typeof event.data === 'string') { - this.trigger(event.data); - if (this.messages[event.data]) { - this.messages[event.data].call(this); - } - } - }, - // send a message to cordova - send: function(message) { - function inIframe(){ - try { - return window.self !== window.top; - } catch (e) { - return true; - } - } - if (inIframe()) { - window.parent.postMessage(message,'file://'); - } - }, - - - // notifies cordova that the webclient is ready. - ready: function() { this.send('ready'); }, - // notifies cordova that we want to exit the app. - logout: function() { this.send('logout'); }, - // notifies cordova that the point of sale is ready. - posready: function() { this.send('posready'); }, - // notifies cordova that we want to exit the point of sale. - poslogout: function() { this.send('poslogout'); }, - // asks cordova to emit a beep. - beep: function() { this.send('beep'); }, - // ask cordova to vibrate the phone. - vibrate: function() { this.send('vibrate'); }, -}); - -// Singleton module -instance.web.cordova = new instance.web.Cordova(); -})(); diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index d0d8b70a3f3..435287ea162 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -96,7 +96,6 @@ -