Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4566 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ส.ค. 23
1214
Adding button in POS screen แก้ไขแล้ว
1
มี.ค. 24
3254
0
เม.ย. 25
1137
1
ก.พ. 25
2297
2
พ.ค. 24
1714