Tardo / OdooTerminal

Webextension tool for Odoo
GNU Affero General Public License v3.0
119 stars 27 forks source link

Getting 400 Bad Request on function call #34

Closed mads-vkd closed 3 years ago

mads-vkd commented 3 years ago

Hi :)

After the latest update I've started getting a wekzeug.exceptions.BadRequest: 400 error when trying to call a function via Odoo Terminal. It started on multiple instances of Odoo where there were no issue with using Odoo Terminal prior to the update, and it seems to occur even on functions created specifically for testing purposes (i.e. that's nothing but loggers - so nothing in the function themselves that should cause the problem).

If/when I implement such a function - e.g. on a button - and run it from Odoo itself, it goes through without issue, which is what leads me to believe it's the recent update for Odoo Terminal that started it.


Traceback (most recent call last):
  File "/home/redacted/src/odoo/odoo/http.py", line 624, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/redacted/src/odoo/odoo/http.py", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/home/redacted/src/odoo/odoo/tools/pycompat.py", line 14, in reraise
    raise value
  File "/home/redacted/src/odoo/odoo/http.py", line 669, in dispatch
    result = self._call_function(**self.params)
  File "/home/redacted/src/odoo/odoo/http.py", line 318, in _call_function
    raise werkzeug.exceptions.BadRequest(msg % params)
werkzeug.exceptions.BadRequest: 400 Bad Request: <function Home.web_client at 0x7f5f0975ca60>, /web: Function declared as capable of handling request of type 'http' but called with a request of type 'json'```
Tardo commented 3 years ago

Thanks for report, should be fixed in the next version. I need improve the tests :/

mads-vkd commented 3 years ago

It happens. :) Let me know if I can help - been using Odoo Terminal so much that I'd feel bad if I didn't help out a bit. ;)