Odoo Help

0
4 Answers
0
Daan Veldhof
5/28/18, 2:51 AM

I was checking the .config file when I noticed the server_wide_modules parameter. When I added my custom module to that parameter everything worked fine.

server_wide_modules = web,web_kanban,test_module
0

I just faced the same problem. When I am authenticated, I can access the controller when I am not I get a server error.

The solution that worked for me is to add a sudo before the execution of the create. Below you can find my code.

http://my.domain:8069/route?a=test

# -*- coding: utf-8 -*-
import werkzeug
from odoo import http
from odoo.http import request
import logging
class MyClass(http.Controller):
    @http.route(['/route'], type='http', auth="none", csrf=False)
    def your_function(self, a):   
        #a is the paramater I send through the http request
        logging.error("it is working")
        vals = {'value': a,}
        request.env['my.module'].sudo().create(vals)
        return "ok"
Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now