跳至内容
菜单
此问题已终结
3 回复
11509 查看

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
1277
2
3月 24
3492
3
10月 23
5841
0
8月 21
3109
6
10月 20
3668