【发布时间】:2020-06-26 00:51:46
【问题描述】:
您好,我正在尝试覆盖 Odoo-12 POS 中 PaymentScreenWidget 中的 renderElement 函数
这是我目前尝试过的
POSScreen.PaymentScreenWidget.include({
renderElement: function() {
var self = this;
this._super();
var numpad = this.render_numpad();
numpad.appendTo(this.$('.payment-numpad'));
var methods = this.render_paymentmethods();
methods.appendTo(this.$('.paymentmethods-container'));
this.render_paymentlines();
this.$('.back').click(function(){
self.click_back();
});
this.$('.next').click(function(){
if(self.check_payment_line() == "Cheque"){
self.pos.gui.show_popup('confirm',{
'title': _t('Payment Method Confirm'),
'body': _t('Cheque Payment method detected need the Cheque information first'),
confirm: function(){
self.enable_keyboard();
self.pos.gui.show_popup('cheque_input_popup_widget',{
title: _t('Check Input'),
});
},
});
}else if(self.check_payment_line() == "Cash"){
self.validate_order();
}
});
this.$('.js_set_customer').click(function(){
self.click_set_customer();
});
this.$('.js_tip').click(function(){
self.click_tip();
});
this.$('.js_invoice').click(function(){
self.click_invoice();
});
this.$('.js_cashdrawer').click(function(){
self.pos.proxy.open_cashbox();
});
},
});
它确实有效,但它使支付屏幕上的所有按钮加倍
我也尝试将this._super(); 替换为PosBaseWidget.prototype.renderElement.call(this);
但问题是在付款过程中,我回到销售部分,付款部分中的所有按钮都留下并覆盖了屏幕
【问题讨论】:
标签: javascript overriding odoo odoo-12 point-of-sale