Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

http.route(... auth="none") not working in Odoo11

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
controllerroute
4 Respostas
6881 Visualizações
Avatar
Ed Gow

In my Odoo 11 server addon module have a web controller that uses auth='none' to provide an API. I have constructed it per documentation and examples from Odoo code. I want it to be available for non-Odoo callers w/o a session. Here is the code


class MyController(http.Controller):
log.info('loading MyController class')
# route declaration example copied from Odoo codebase
# @http.route('/web/database/create', type='http', auth="none", methods=['POST'], csrf=False)
@http.route('/my_controller/event/', type='http', auth='none', methods=['POST'], csrf=False)
def index(self, **post):
return "Hello, world"



I know the class is being loaded because of the logging. The route declarations is copied from Odoo code that does get the route registered. Am I doing something wrong, or is this an Odoo bug? If it's me, how is the Odoo code managing to get its route entered into the nodb_routing_map?

Any solution would be most appreciated.


0
Avatar
Cancelar
Ed Gow
Autor

I should note that if the route is called from a browser with an active Odoo session then it is found and the decorated function gets executed. The problem is that auth='none' is documented as making the route always available, such as when there is no session or active DB. That is not happening in this case.

Avatar
Ed Gow
Autor Melhor resposta

OK, I got it. In order to work as advertised in the documentation, the module must be specified in the config for server_wide_modules in the [options] section or equivalently by the --load CLI option. The default in the code is to have only web specified for this option.

NOTE: If you avail yourself of this option be sure to include web in your list. Leaving it out will cause the entire /web/... hierarchy of URLs to generate 404 Not Found errors.

In the config file it looks like this:

    server_wide_modules = web,my_controller_module

On the command line it is:

    --load web,my_controller_module

Since the entire server_wide_modules/--load option is not described in the documents, I have no idea what else it might affect. It would be truly lovely if this were in the documentation somewhere.


ADDENDUM:

I can add some info provided by  pedrobaeza [https://github.com/pedrobaeza].  The behavior depends on whether there is a single DB or multiple DBs active in the server. With only one DB the `auth="none"` feature works per the docs. With more than one it behaves as I have described. If you have trouble with an `auth="none"` web controller limit your server to one DB using the `-d` option or else add your module to the `--load` list along with `web`.

0
Avatar
Cancelar
Niyas Raphy (Walnut Software Solutions)

If you like to improve the odoo documentation, you can edit it in github and create a PR, then odoo will check and merge it.

For future reference, regarding the controllers: https://www.youtube.com/watch?v=8395q9DYHfg&t=17s

Ed Gow
Autor

Hi Niyas,

Thank you for the video link. My controller needs auth="none", which I think is outside the scope, but with Odoo more info is always better.

Since I don't know all of the effects of the --load option I'm hesitant to try to document it myself. Also I work for a large organization that makes the paperwork to satisfy the Odoo contributor agreement very troublesome. I'll try to find a way to get this properly documented so that no other Odoo users have to waste a day discovering it as I did.

Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
Problem with the controller routes
controller route
Avatar
Avatar
2
mar. 16
5156
session_id as GET parameter in URL returns 404
session_id controller route
Avatar
Avatar
Avatar
3
out. 15
12824
No Buy Route in Odoo 18 Resolvido
route
Avatar
Avatar
1
out. 25
1648
Controller not working Resolvido
controller
Avatar
Avatar
2
fev. 23
3953
Changing route on confirmed sale order Resolvido
route
Avatar
Avatar
Avatar
3
mai. 21
5001
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now