How to get the current order id in pos when clicking the payment validate button using js
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Comptabilité
- Inventaire
- PoS
- Project
- MRP
Cette question a été signalée
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
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
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrirePublications associées | Réponses | Vues | Activité | |
---|---|---|---|---|
|
0
août 23
|
1079 | ||
Adding button in POS screen
Résolu
|
|
1
mars 24
|
3111 | |
|
0
avr. 25
|
925 | ||
|
1
févr. 25
|
2022 | ||
|
2
mai 24
|
1608 |