Skip to Content
Menu
This question has been flagged
1 Reply
2413 Views

i want to add a menu item to the website that i created in odoo but when i try a simple controller i get a 404 error 
# -*- coding: utf-8 -*-from odoo import http# from odoo.http import request
classMyController(http.Controller):@http.route('/mission', website=True, type='http')defindex(self, **kw):

​return"Working!"
the module should be working fine since i already have 2 models running and i see no eroors in the logs 
2023-08-11 09:06:47,773 1 INFO db_web werkzeug: 172.18.0.1 - - [11/Aug/2023 09:06:47] "GET /mission HTTP/1.1" 404 - 22 0.014 0.024

2023-08-11 09:06:48,061 1 INFO db_web werkzeug: 172.18.0.1 - - [11/Aug/2023 09:06:48] "POST /web/dataset/call_kw/web_tour.tour/get_consumed_tours HTTP/1.1" 200 - 4 0.002 0.005

any help would be appreciated

Avatar
Discard
Author

Thank you very much !!!

Best Answer

Hi ahmedkacem,

and this file import in __init__.py of your controller directory like from . import mission  add this it will work fine.


also check below if you have more than 1 controller in same class:

  • Every controller should have unique method names



Avatar
Discard