refactor: update service references and remove unused jsonrpc import for Odoo 19 compatibility
This commit is contained in:
parent
e3c152c102
commit
9b4855b396
@ -3,7 +3,8 @@
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { NumberPopup } from "@point_of_sale/app/components/popups/number_popup/number_popup";
|
||||
import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_screen";
|
||||
import { jsonrpc } from "@web/core/network/rpc_service";
|
||||
// jsonrpc removed - not used and causing dependency error in Odoo 19
|
||||
|
||||
import { AlertDialog as ErrorPopup } from "@web/core/confirmation_dialog/confirmation_dialog";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
//Refund password validation and popup
|
||||
@ -12,7 +13,7 @@ patch(TicketScreen.prototype, {
|
||||
const order = this.getSelectedOrder();
|
||||
// Check if order is posted
|
||||
if (order.state == 'done') {
|
||||
this.popup.add(ErrorPopup,{
|
||||
this.env.services.popup.add(ErrorPopup,{
|
||||
body : _t('Refund Not Allowed, This order has already been posted and cannot be refunded.'),
|
||||
});
|
||||
return;
|
||||
@ -20,29 +21,29 @@ patch(TicketScreen.prototype, {
|
||||
|
||||
var refund="";
|
||||
var session_refund= false;
|
||||
var data = await this.orm.call("pos.config", "fetch_global_refund_security", [])
|
||||
var data = await this.env.services.orm.call("pos.config", "fetch_global_refund_security", [])
|
||||
refund = data;
|
||||
if (!refund){
|
||||
session_refund = this.pos.config.refund_security;
|
||||
}
|
||||
if(refund){
|
||||
const { confirmed, payload } = await this.popup.add(NumberPopup, { isPassword: true })
|
||||
const { confirmed, payload } = await this.env.services.popup.add(NumberPopup, { isPassword: true })
|
||||
if(refund == payload){
|
||||
super.onDoRefund(...arguments);
|
||||
}
|
||||
else{
|
||||
this.popup.add(ErrorPopup,{
|
||||
this.env.services.popup.add(ErrorPopup,{
|
||||
body : _t('Invalid Password, Enter your global password'),
|
||||
});
|
||||
}
|
||||
}
|
||||
else if(session_refund){
|
||||
const { confirmed, payload } = await this.popup.add(NumberPopup, { isPassword: true })
|
||||
const { confirmed, payload } = await this.env.services.popup.add(NumberPopup, { isPassword: true })
|
||||
if(session_refund == payload){
|
||||
super.onDoRefund(...arguments);
|
||||
}
|
||||
else{
|
||||
this.popup.add(ErrorPopup,{
|
||||
this.env.services.popup.add(ErrorPopup,{
|
||||
body : _t('Incorrect Password'),
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user