Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
11500 Weergaven

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

Avatar
Annuleer
Auteur Beste antwoord

@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

Avatar
Annuleer
Auteur

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

Beste antwoord

Put this in your model function and should return the response

Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer

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.

Gerelateerde posts Antwoorden Weergaven Activiteit
2
jul. 24
1263
2
mrt. 24
3484
3
okt. 23
5831
0
aug. 21
3105
6
okt. 20
3664