__init__.py 691 B

1234567891011121314151617181920212223
  1. from odoo import models
  2. from odoo.exceptions import AccessDenied
  3. from odoo.http import Controller, route
  4. class IrHttp(models.AbstractModel):
  5. _inherit = 'ir.http'
  6. @classmethod
  7. def _auth_method_thing(cls):
  8. raise AccessDenied()
  9. class TestController(Controller):
  10. # for HTTP endpoints, must allow OPTIONS or werkzeug won't match the route
  11. # when dispatching the CORS preflight
  12. @route('/test_auth_custom/http', type="http", auth="thing", cors="*", methods=['GET', 'OPTIONS'])
  13. def _http(self):
  14. raise NotImplementedError
  15. @route('/test_auth_custom/json', type="json", auth="thing", cors="*")
  16. def _json(self):
  17. raise NotImplementedError