Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
4568 Ansichten

How to get the current order id in pos when clicking the payment validate button using js

Avatar
Verwerfen
Beste Antwort

Hi,

If you need to get the current order while validating the payment, you need to extend the payment validate function, check the code below,
by using this.env.pos.get_order() we can get the current order.

odoo.define('module_name.PaymentScreen', function(require) {
'use strict';
const PaymentScreen = require('point_of_sale.PaymentScreen');
const Registries = require('point_of_sale.Registries');
const session = require('web.session');

const InvoicePaymentScreen = PaymentScreen =>
class extends PaymentScreen {
setup() {
super.setup();
}

async validateOrder(isForceValidate) {
const order = this.env.pos.get_order();
console.log(order,"Current order")
await super.validateOrder(isForceValidate);

//add your code here.
}
}
};

Registries.Component.extend(PaymentScreen, InvoicePaymentScreen);

return PaymentScreen;
});


Hope it helps

Avatar
Verwerfen
Beste Antwort

Hi 

we can get current order using this.currentOrder

for example,if we need to call total amount we can call it as follows

Try this 

var total = this.currentOrder.get_total_with_tax()


Regards

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Aug. 23
1214
1
März 24
3254
0
Apr. 25
1137
1
Feb. 25
2297
2
Mai 24
1714