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

Pyhton Code not working in Automated Actions

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
2 Respostas
3139 Visualizações
Avatar
Nathan

Hello.


Sorry if it's a basic question, I'm new to ODOO and to Python. I'm having trouble with automated actions (ODOO 12.0+e-20181025). I created an automated actions, set it to execute python code with the following code: (the logic is to write current datetime into a field when field team_id is == 160)

if model\\\\.helpdesk\\\\.team\\\\.id:
if\\\ record\\\.team_id:
\\\ \\\ \\\ ​if\\\ record\\\.team_id\\\ ==\\\ 160:
\\\ \\\ \\\ \\\ \\\ ​\\\ ​cs_handling_time\\\ =\\\ datetime.datetime.now()
​ ​record.write({'x_studio_cs_handling_time': cs_handling_time})



When I update a ticket matching all the conditions, the field cs_handling_time is not updated. If I remove the IF logic, it works just fine. Does pyhton code in odoo's automated actions has a different if logic?


P.S: I input the logic of checking team_id in the python code because I will need multiple team_id, so I cannot put it in the "before update domain" or "apply on" field

0
Avatar
Cancelar
Avatar
Kiran K
Melhor resposta

Hi  Nathan,

First, make sure that the module 'base_automation' is installed in your instance. 

If it's installed, go to the "Settings" menu. Activate Developer Mode and

Goto "Settings" -> "Technical" -> "Automation" -> "Automated Actions."

Click on the "Create" button to create a new automated action.




Hope it helps,

Kiran K

1
Avatar
Cancelar
Nathan
Autor

Hello Kiran!

Thanks for your response.

Yes, the module "base_automation" is installed. The screenshot I gave was actually from the automated actions page.

I found out that I'm missing something important, and you showed it to me in your screenshot. In my code, I used "record.team_id == 160", but in the screenshot you used "record.team_id.id == 1". When I fixed my code into record.team_id.id, it works now. Thanks a lot!

Cheers,
Nathan

Kiran K

I'm glad to hear that it helps you :)

Avatar
Abdul Qoudouss
Melhor resposta

Hello. Try the same code but remove the first line.

so u'll have the code bellow

if record.team_id:

​ cs_handling_time =datetime.datetime.now()
​ ​ ​record.write({'x_studio_cs_handling_time': cs_handling_time})

But u are not on automate actions record , rather on action server 

So go to Automate actions and write the code. U must have this window

Regards !

My whatsApp number for assistance : +225 05 45 14 53 91

0
Avatar
Cancelar
Nathan
Autor

Hi Abdul!

Thanks for your response.

I did write my code in the action server actually. The issue was the if logic in my python code. I actually resolved it after missing an important parameter in my code. Thanks for your answer!

Cheers,
Nathan

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
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