Skip to Content
Odoo Menu
  • Sign in
  • Teste-o gratuitamente
  • Aplicações
    Finanças
    • Contabilidade
    • Faturação
    • Despesas
    • Folha de cálculo (BI)
    • Documentos
    • Assinatura eletrónica
    Vendas
    • CRM
    • Vendas
    • POS para lojas
    • POS para restaurantes
    • Subscrições
    • Aluguer
    Sites
    • Criador de Sites
    • Comércio eletrónico
    • Blogue
    • Fórum
    • Chat em direto
    • e-Learning
    Cadeia de abastecimento
    • Inventário
    • Produção
    • PLM
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Colaboradores
    • Recrutamento
    • Ausências
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Marketing social
    • Marketing por e-mail
    • Marketing através de SMS
    • Eventos
    • Automação de Marketing
    • Inquéritos
    Serviços
    • Projeto
    • Registos de Horas
    • Assistência no local
    • Assistência
    • Planeamento
    • Agendamentos
    Produtividade
    • Conversas
    • Inteligência artificial
    • IoT
    • VoIP
    • Informação
    • WhatsApp
    Aplicações de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Retalho
    • Livraria
    • Loja de roupa
    • Loja de móveis
    • Mercearia
    • Loja de ferragens
    • Loja de brinquedos
    Alimentação e hotelaria
    • Bar e pub
    • Restaurante
    • Comida rápida
    • Casa de hóspedes
    • Distribuidor de bebidas
    • Hotel
    Imobiliário
    • Agência imobiliária
    • Gabinete de arquitectura
    • Construção
    • Gestão imobiliária
    • Jardinagem
    • Associação de proprietários
    Consultoria
    • Gabinete de contabilidade
    • Parceiro da Odoo
    • Agência de marketing
    • Sociedade de advogados
    • Aquisição de talentos
    • Auditoria e certificação
    Produção
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Brindes promocionais
    Saúde e bem-estar
    • Clube desportivo
    • Ótica
    • Ginásio
    • Profissionais de bem-estar
    • Farmácia
    • Cabeleireiro
    Ofícios
    • Handyman
    • Hardware e suporte técnico
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência do ambiente
    • Aluguer de painéis publicitários
    • Estúdio de fotografia
    • Aluguer de bicicletas
    • Revendedor de software
    Explorar todos os setores
  • Comunidade
    Aprender
    • Tutoriais
    • Documentação
    • Certificações
    • Treino
    • Blogue
    • Podcast
    Capacitar a educação
    • Programa de formação
    • Scale Up! O jogo de negócios
    • Visite a Odoo
    Obter o software
    • Transferir
    • Comparar Edições
    • Versões
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Registe a sua empresa contabilística
    • Programa de afiliados
    Obter serviços
    • Encontre um parceiro
    • Encontre um contabilista
    • Contacte um consultor
    • Serviços de implementação
    • Referências de clientes
    • Apoio
    • Atualizações
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar uma demonstração
  • Preços
  • Ajuda
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

User statement for function

Subscribe

Get notified when there's activity on this post

This question has been flagged
functionv8statementodoo8
4 Replies
5329 Views
Avatar
wizardz

How can I make a user role - Project Manager or User statement for a function?

like this :

def onchange_planned(self, cr, uid, ids, planned=0.0, effective=0.0):

if user_id.sel_groups_44_45 == 45:

return {'value': {'remaining_hours': planned - effective}}


But it doesn't work.

0
Avatar
Discard
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Best Answer

Hi Wizardz,

You should check if particular group is assigned to current logged in user to fulfill your requirement.

if self.pool.get('res.users').has_group(cr, uid, 'module_name.XML_ID_of_group'): # return True if group is assigned to user, False otherwise
#your logic goes here if user exists in the group

Source Code 

Hope this help you.

3
Avatar
Discard
wizardz
Author

I don't wanna get the group, In the settings per user in Project, you can choose from manager and user. I wanna set a if the user is a user in projcect, or a manager

wizardz
Author

or is it like this the ID from the group xml : if self.pool.get('res.users').has_group(cr, uid, 'res.groups.84'):

Sudhir Arya (ERP Harbor Consulting Services)

You can apply groups on planned_hours field. Users who are not in that group, won't be able to see the field.

wizardz
Author

and how? please

Avatar
wizardz
Author Best Answer

If I do this: 

    def onchange_planned(self, cr, uid, ids, planned=0.0, effective=0.0):

if self.pool.get('res.users').has_group(cr, uid, 'project.group_project_manager'): # return True if group is assigned to user, False otherwise
#your logic goes here if user exists in the group
return {'value': {'remaining_hours': planned - effective}}
raise osv.except_osv(('Info'), ('You are not available to change the planned time settings.'))


Other user get the raise info message but can change the planned_hours. Why? How Can I stop that a user not in this group can't CHANGE the planned hours??????? 

0
Avatar
Discard
wizardz
Author

How can I stop that the value I put in is going to save?

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
How know list of Python called methods when I press a button?
v8 odoo8
Avatar
Avatar
Avatar
7
mai. 20
9037
Sort in Odoo report
v8 odoo8
Avatar
0
abr. 16
4661
Check that a field not changes after edition Solved
v8 odoo8
Avatar
Avatar
Avatar
2
abr. 15
8122
Hide field in a tree view Solved
v8 views odoo8
Avatar
Avatar
Avatar
Avatar
11
set. 21
35975
Group by on field of a related model. Solved
v8 group_by odoo8
Avatar
Avatar
Avatar
2
jan. 24
17862
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Código aberto
  • Transferir
  • Github
  • Runbot
  • Traduções
Serviços
  • Alojamento Odoo.sh
  • Apoio
  • Atualizar Versão
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um contabilista
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • A Nossa Empresa
  • Ativos da marca
  • Contacte-nos
  • Trabalhos
  • Eventos
  • Podcast
  • Blogue
  • 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) Português română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

O Odoo é um conjunto de aplicações empresariais de código aberto que abrange todas as necessidades da sua empresa: CRM, comércio eletrónico, contabilidade, gestão de inventário, ponto de venda, gestão de projetos, etc.

A proposta de valor única do Odoo é ser, ao mesmo tempo, muito fácil de utilizar e totalmente integrado.

Website made with

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