Revert "[IMP] web, point_of_sale: basic implementation of the cordova integration."

This reverts commit f7a1ac8b06.
The commit introduced a change that required a database update,
which should not be required in a stable version.
This commit is contained in:
Frédéric van der Essen 2015-05-27 13:46:26 +02:00
parent f7a1ac8b06
commit da378722cc
4 changed files with 0 additions and 89 deletions

View File

@ -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) {

View File

@ -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');
}
},

View File

@ -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();
})();

View File

@ -96,7 +96,6 @@
<script type="text/javascript" src="/web/static/src/js/core.js"></script>
<script type="text/javascript" src="/web/static/src/js/formats.js"></script>
<script type="text/javascript" src="/web/static/src/js/chrome.js"></script>
<script type="text/javascript" src="/web/static/src/js/cordova.js"></script>
<script type="text/javascript" src="/web/static/src/js/views.js"></script>
<script type="text/javascript" src="/web/static/src/js/data.js"></script>
<script type="text/javascript" src="/web/static/src/js/data_export.js"></script>