Browse Source

[FIX] beesdoo_pos: eaters on action pad and payment screen

pull/146/head
Manuel Claeys Bouuaert 5 years ago
committed by Rémy Taymans
parent
commit
1d4b7a8a54
  1. 31
      beesdoo_pos/static/src/js/beesdoo.js

31
beesdoo_pos/static/src/js/beesdoo.js

@ -1,7 +1,7 @@
odoo.define('beescoop.pos', function (require) { odoo.define('beescoop.pos', function (require) {
"use strict"; "use strict";
var module = require("point_of_sale.screens"); var module = require("point_of_sale.screens");
var Model = require('web.DataModel');
var rpc = require('web.rpc')
var set_customer_info = function(el_class, value, prefix) { var set_customer_info = function(el_class, value, prefix) {
var el = this.$(el_class); var el = this.$(el_class);
el.empty(); el.empty();
@ -23,13 +23,20 @@ odoo.define('beescoop.pos', function (require) {
} }
var customer_id = this.pos.get_client().id; var customer_id = this.pos.get_client().id;
var res = new Model('res.partner').call('get_eater',
[ customer_id ], undefined, { shadow: true, timeout: 1000});
res.then(function(result) {
this._rpc({
model: 'res.partner',
method: 'get_eater',
args: [customer_id],
}, {
shadow: true,
}, {
timeout: 1000,
})
.then(function (result) {
set_customer_info.call(self, '.customer-delegate1', result[0], 'Eater 1: '); set_customer_info.call(self, '.customer-delegate1', result[0], 'Eater 1: ');
set_customer_info.call(self, '.customer-delegate2', result[1], 'Eater 2: '); set_customer_info.call(self, '.customer-delegate2', result[1], 'Eater 2: ');
set_customer_info.call(self, '.customer-delegate3', result[2], 'Eater 3: '); set_customer_info.call(self, '.customer-delegate3', result[2], 'Eater 3: ');
}, function(err) {
}).fail(function (type, error){
loaded.reject(err); loaded.reject(err);
}); });
}, },
@ -43,13 +50,21 @@ odoo.define('beescoop.pos', function (require) {
return return
} }
var customer_id = this.pos.get_client().id; var customer_id = this.pos.get_client().id;
var res = new Model('res.partner').call('get_eater', [ customer_id ], undefined, { shadow: true, timeout: 1000});
res.then(function(result) {
this._rpc({
model: 'res.partner',
method: 'get_eater',
args: [customer_id],
}, {
shadow: true,
}, {
timeout: 1000,
})
.then(function (result) {
set_customer_info.call(self, '.customer-name', self.pos.get_client().name); set_customer_info.call(self, '.customer-name', self.pos.get_client().name);
set_customer_info.call(self, '.customer-delegate1', result[0], 'Eater 1: '); set_customer_info.call(self, '.customer-delegate1', result[0], 'Eater 1: ');
set_customer_info.call(self, '.customer-delegate2', result[1], 'Eater 2: '); set_customer_info.call(self, '.customer-delegate2', result[1], 'Eater 2: ');
set_customer_info.call(self, '.customer-delegate3', result[2], 'Eater 3: '); set_customer_info.call(self, '.customer-delegate3', result[2], 'Eater 3: ');
}, function(err) {
}).fail(function (type, error){
loaded.reject(err); loaded.reject(err);
}); });
}, },

Loading…
Cancel
Save