python-3.xodooodoo-17

What is the purpose of overriding Odoo controllers with an empty @http.route() definition?


The method (and route) must be decorated using route() in order to remain visible. According to the Odoo documentation, if the method is redefined without decorating, it will become "unpublished."

I noted that the function is called in both scenarios, thus I am curious about the differences in workflow between using the route() decorator during overriding and not using it. Has anyone noticed a difference?


Solution

  • As you noted, if you override a method in Odoo without also adding the route() decorator, you might run into the problem of the method becoming "unpublished," which means that although it is still there in your code, it will not be exposed as an HTTP route and thus cannot be accessed via a URL.