콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
11529 화면

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

아바타
취소
작성자 베스트 답변

@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

아바타
취소
작성자

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

베스트 답변

Put this in your model function and should return the response

아바타
취소
베스트 답변

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

아바타
취소

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.

관련 게시물 답글 화면 활동
2
7월 24
1295
2
3월 24
3510
3
10월 23
5856
0
8월 21
3125
6
10월 20
3680