Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
11621 Widoki

Hi, 

I'm new to odoo and I want to call an API when a payment get confirmed, i mean i want to override the confirm function to call a rest API with get method, can anyone give me any example for the code or any helpful links please

Thank you

Awatar
Odrzuć
Autor Najlepsza odpowiedź

@api.model
def create(self, values):
record = super(ClassName, self).create(values)
import requests
username = record.username
invoice = record.invoice
credit = record.amount
payment_date= record.payment_date
response = requests.get("http://example.com?user="+ username +  "&invoice=" + invoice + "&credit=" + str(credit) + "&date=" + str(payment_date))
return record

Awatar
Odrzuć
Autor

i solved it this way, hope it's helpful to any one

Najlepsza odpowiedź

Put this in your model function and should return the response

Awatar
Odrzuć
Najlepsza odpowiedź

Hi Ali,

Where did you put this code in the ODOO interface ?

I'm trying to do it from a server action but without success .. :(

Thx

Awatar
Odrzuć

Please also try posting your own question. You have asked a new question in the comment of a resolved question, so some people might not think to open the post unless they are interested in the answer to the original question.

Powiązane posty Odpowiedzi Widoki Czynność
2
lip 24
1386
2
mar 24
3636
3
paź 23
5951
0
sie 21
3266
6
paź 20
3726