[REVERT] web,point_of_sale: cordova integration
introduced by forwardport:a304194936initial commit in 8.0:19eda68547
This commit is contained in:
@@ -8,7 +8,6 @@ odoo.define('point_of_sale.gui', function (require) {
|
||||
|
||||
var core = require('web.core');
|
||||
var Model = require('web.Model');
|
||||
var cordova = require('web.cordova');
|
||||
|
||||
var _t = core._t;
|
||||
|
||||
@@ -27,7 +26,6 @@ var Gui = core.Class.extend({
|
||||
this.current_screen = null;
|
||||
|
||||
this.chrome.ready.then(function(){
|
||||
cordova.posready();
|
||||
self.close_other_tabs();
|
||||
var order = self.pos.get_order();
|
||||
if (order) {
|
||||
@@ -335,7 +333,6 @@ var Gui = core.Class.extend({
|
||||
this.chrome.loading_message(_t('Closing ...'));
|
||||
|
||||
this.pos.push_order().then(function(){
|
||||
cordova.poslogout();
|
||||
return new 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'];
|
||||
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
odoo.define('web.Cordova', function(require) {
|
||||
"use strict";
|
||||
|
||||
var core = require('web.core');
|
||||
|
||||
// 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.
|
||||
|
||||
var Cordova = core.Class.extend({}, core.mixins.PropertiesMixin, {
|
||||
init: function(parent) {
|
||||
var self = this;
|
||||
core.mixins.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'); },
|
||||
});
|
||||
|
||||
return Cordova;
|
||||
});
|
||||
|
||||
// Singleton module
|
||||
odoo.define('web.cordova', function(require) {
|
||||
"use strict";
|
||||
var Cordova = require('web.Cordova');
|
||||
return new Cordova();
|
||||
});
|
||||
@@ -3,7 +3,6 @@ odoo.define('web.WebClient', function (require) {
|
||||
|
||||
var ActionManager = require('web.ActionManager');
|
||||
var core = require('web.core');
|
||||
var cordova = require('web.cordova');
|
||||
var crash_manager = require('web.crash_manager');
|
||||
var data = require('web.data');
|
||||
var Loading = require('web.Loading');
|
||||
@@ -62,10 +61,6 @@ var WebClient = Widget.extend({
|
||||
delete(self.client_options.action);
|
||||
}
|
||||
core.bus.trigger('web_client_ready');
|
||||
cordova.ready();
|
||||
cordova.on('back', self, function() {
|
||||
self.do_action('history_back');
|
||||
});
|
||||
});
|
||||
},
|
||||
bind_events: function() {
|
||||
@@ -264,7 +259,6 @@ var WebClient = Widget.extend({
|
||||
on_logout: function() {
|
||||
var self = this;
|
||||
if (!this.has_uncommitted_changes()) {
|
||||
cordova.logout();
|
||||
self.action_manager.do_action('logout');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
<script type="text/javascript" src="/web/static/src/js/framework/session_instance.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/framework/crash_manager.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/framework/barcode_events.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/framework/cordova.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/action_manager.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/control_panel.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/view_manager.js"></script>
|
||||
|
||||
@@ -133,7 +133,6 @@
|
||||
<script type="text/javascript" src="/web/static/src/js/framework/misc.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/framework/session_instance.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/framework/crash_manager.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/framework/cordova.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/widgets/change_password.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/widgets/database_manager.js"></script>
|
||||
<script type="text/javascript" src="/web/static/src/js/widgets/debug_manager.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user