[英]How to override renderElement function in screens.js in Odoo-12 Point of Sale
Hi I'm trying to override the renderElement
function in PaymentScreenWidget
in Odoo-12 POS您好我正在尝试覆盖 Odoo-12 POS 中
PaymentScreenWidget
中的renderElement
function
here's what I've tried so far这是我到目前为止尝试过的
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();
});
},
});
it does work but it doubles all the button in the payment screen它确实有效,但它使支付屏幕中的所有按钮加倍
i have also tried replacing the this._super();
我也尝试过替换
this._super();
with PosBaseWidget.prototype.renderElement.call(this);
使用
PosBaseWidget.prototype.renderElement.call(this);
but the problem is when the payment is process and I go back to selling part all the button in the payment part is left and covers the screen但问题是在付款过程中,我 go 回到销售部分 付款部分中的所有按钮都留在了屏幕上
user9523333用户9523333
Try This code
to access the PaymentScreenWidget
:试试这个
code
来访问PaymentScreenWidget
:
odoo.define('module.ScreenCustomise', function(require) {
"use strict";
var screens = require('point_of_sale.screens');
var PaymentScreenWidget = screens.PaymentScreenWidget;
PaymentScreenWidget.include({
renderElement: function() {
var self = this;
this._super();
// Customise Your Code
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.