Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1510 Lượt xem

Hi, for the plugin i am working on, i need to access the value of one of my fields before the user has click on the "pay now" button.

With my test, i have come to the conclusion that all of my fields i have put in the payment_provider files value are only updated after the order has been created.

What i mean is that when i try to acces the value of my fields on the "/shop/payment" page, i get "False". When i get them after i have clicked on the button i get the value intended.


Is there anyway to make it so that the value are updated before the click?


Thank you in advance


I am working on odoo 16

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

So i found a solution :

In the function  _prepareInlineForm from the payment_form_mixin.js, get the paymentOptionId argument into your python.

Then with " request.env['payment.provider'].sudo().browse(paymentOptionId).exists()" you can create an access to your variable and get them like this

request.env['payment.provider'].sudo().browse(provider_id).exists().My_variable


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 23
2780
1
thg 4 24
2525
2
thg 4 24
2867
0
thg 2 24
1195
0
thg 2 24
1167