コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
4542 ビュー

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

アバター
破棄
関連投稿 返信 ビュー 活動
0
8月 23
1201
1
3月 24
3244
0
4月 25
1095
1
2月 25
2255
2
5月 24
1707