[英]How to inherit Payment screen and add validation in _finalizeValidation()
I want to inherit _finalizeValidation()
method from the paymentscreen
of odoo15
in which I just want to add a condition that if the invoice
is selected in the payment screen
then the validate button
will function and will move on to the receipt screen else will give a user error, and I am not getting a way to inherit and do so, Any help in this will be greatly appreciated我想从
odoo15
的paymentscreen
屏幕继承_finalizeValidation()
方法,我只想添加一个条件,如果在payment screen
中选择了invoice
,则validate button
将为 function 并将移至收据屏幕,否则将给出一个用户错误,我没有办法继承并这样做,对此的任何帮助将不胜感激
You can find an example in the pos_hr module where they inherit the _finalizeValidation
function to set the employee on the current order:您可以在pos_hr模块中找到一个示例,其中他们继承了
_finalizeValidation
function 以在当前订单上设置员工:
odoo.define('pos_hr.PaymentScreen', function (require) {
'use strict';
const PaymentScreen = require('point_of_sale.PaymentScreen');
const Registries = require('point_of_sale.Registries');
const PosHrPaymentScreen = (PaymentScreen_) =>
class extends PaymentScreen_ {
async _finalizeValidation() {
this.currentOrder.employee = this.env.pos.get_cashier();
await super._finalizeValidation();
}
};
Registries.Component.extend(PaymentScreen, PosHrPaymentScreen);
return PaymentScreen;
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.