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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
2
Trả lời
4324
Lượt xem
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
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 8 23
|
1087 | ||
Adding button in POS screen
Đã xử lý
|
|
1
thg 3 24
|
3118 | |
|
0
thg 4 25
|
934 | ||
|
1
thg 2 25
|
2030 | ||
|
2
thg 5 24
|
1620 |