I need to redirect Odoo to an external website via http POST request.
Is this possible?
I can´t find any examples for it.
ir.actions.act_url only works for http GET.
Any ideas?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I need to redirect Odoo to an external website via http POST request.
Is this possible?
I can´t find any examples for it.
ir.actions.act_url only works for http GET.
Any ideas?
By default, all links clicked through a browser are GET requests. In order for a browser to send a POST request, you'll need to create custom JavaScript to POST the data to the URL.
You could also create a custom web controller to receive the GET request locally, and then issue the POST request in python to the external URL.
Thanks. I´m trying with the web controller but I can´t issue the POST request in python. How do you change the request method to POST and redirect to it? @http.route('/redirect_post', type='http', auth="none", methods=['GET']) def redirect_post(self, **post): cr, uid, context = request.cr, request.uid, request.context #redirect to an external url changing to POST and adding parameters
import requests
payload = {'key1': 'value1', 'key2': 'value2'}
r = requests.post("http://httpbin.org/post", data=payload)
Thanks. I´m trying with the web controller but I can´t issue the POST request in python. How do you change the request method to POST and redirect to it? @http.route('/redirect_post', type='http', auth="none", methods=['GET']) def redirect_post(self, **post): cr, uid, context = request.cr, request.uid, request.context #redirect to an external url changing to POST and adding parameters
--
Martin Varela
Sent by Odoo Inc. using Odoo access your messages
I've tried that, but when I return de request "r" raises a warning and then an error: WARNING openerp.http: returns an invalid response type for an http request ERROR werkzeug: Error on request: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/werkzeug/serving.py", line 177, in run_wsgi execute(self.server.app) File "/usr/lib/python2.7/site-packages/werkzeug/serving.py", line 165, in execute application_iter = app(environ, start_response) File "/usr/lib/python2.7/site-packages/openerp/service/server.py", line 281, in app return self.app(e, s) File "/usr/lib/python2.7/site-packages/openerp/service/wsgi_server.py", line 216, in application return application_unproxied(environ, start_response) File "/usr/lib/python2.7/site-packages/openerp/service/wsgi_server.py", line 202, in application_unproxied result = handler(environ, start_response) File "/usr/lib/python2.7/site-packages/openerp/http.py", line 1215, in __call__ return self.dispatch(environ, start_response) File "/usr/lib/python2.7/site-packages/openerp/http.py", line 1189, in __call__ return self.app(environ, start_wrapped) File "/usr/lib/python2.7/site-packages/werkzeug/wsgi.py", line 579, in __call__ return self.app(environ, start_response) File "/usr/lib/python2.7/site-packages/openerp/http.py", line 1362, in dispatch return response(environ, start_response) TypeError: 'Response' object is not callable
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 9 22
|
6008 | ||
|
4
thg 12 23
|
24644 | ||
|
2
thg 4 16
|
4182 | ||
|
0
thg 6 24
|
1792 | ||
|
1
thg 6 24
|
1276 |