Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
4320 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
srp 23
1083
1
bře 24
3117
0
dub 25
932
1
úno 25
2029
2
kvě 24
1618