Browse Source

Cleaner inheritance implementation in pos_customer_display

Better debug logs in hw_* modules for LCD and Telium
pull/437/head
Alexis de Lattre 10 years ago
committed by Sylvain LE GAL
parent
commit
40f2edc759
  1. 55
      pos_customer_display/static/src/js/customer_display.js

55
pos_customer_display/static/src/js/customer_display.js

@ -199,9 +199,9 @@ openerp.pos_customer_display = function(instance){
return res;
};
var _super_update_payment_summary_ = module.PaymentScreenWidget.prototype.update_payment_summary;
module.PaymentScreenWidget.prototype.update_payment_summary = function(){
res = _super_update_payment_summary_.call(this);
module.PaymentScreenWidget.include({
update_payment_summary: function(){
res = this._super();
var currentOrder = this.pos.get('selectedOrder');
var paidTotal = currentOrder.getPaidTotal();
var dueTotal = currentOrder.getTotalTaxIncluded();
@ -211,39 +211,40 @@ openerp.pos_customer_display = function(instance){
this.pos.prepare_text_customer_display('update_payment', {'change': change_rounded});
}
return res;
};
},
});
var _super_closePOS_ = module.PosWidget.prototype.close;
module.PosWidget.prototype.close = function(){
module.PosWidget.include({
close: function(){
this._super();
this.pos.prepare_text_customer_display('closePOS', {});
return _super_closePOS_.call(this);
};
},
});
var _super_proxy_start_ = module.ProxyStatusWidget.prototype.start;
module.ProxyStatusWidget.prototype.start = function(){
res = _super_proxy_start_.call(this);
module.ProxyStatusWidget.include({
start: function(){
this._super();
this.pos.prepare_text_customer_display('openPOS', {});
return res;
};
},
});
/* Handle Button "Display Total to Customer" */
var _super_OrderWidget_init_ = module.OrderWidget.prototype.init;
module.OrderWidget.prototype.init = function(parent, options){
_super_OrderWidget_init_.call(this, parent, options);
/* TODO: understand why Odoo sends the prepare_text_customer_display
3 times to the Posbox/LCD when the user clicks on the button
'Show total to customer' */
module.OrderWidget.include({
update_summary: function(){
console.log('MY update_summary');
this._super();
var self = this;
this.prepare_text_customer_display = function(event){
self.pos.prepare_text_customer_display('addPaymentline', {});
event.stopPropagation();
};
};
var _super_update_summary_ = module.OrderWidget.prototype.update_summary;
module.OrderWidget.prototype.update_summary = function(){
_super_update_summary_.call(this);
if (this.pos.config.iface_customer_display){
console.log('.addEventListener');
this.el.querySelector('.show-total-to-customer')
.addEventListener('click', this.prepare_text_customer_display);
.removeEventListener('click', function(){self.pos.prepare_text_customer_display('addPaymentline', {})});
this.el.querySelector('.show-total-to-customer')
.addEventListener('click', function(){self.pos.prepare_text_customer_display('addPaymentline', {})});
}
};
},
});
};
Loading…
Cancel
Save