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

I got this error AttributeError: 'list' object has no attribute 'id'

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
listattributeerrorodooV8
1 Responder
54619 Visualizações
Avatar
Osmani

Im working with Odoo V8.

Can anybody  help with this error?

AttributeError: 'list' object has no attribute 'id'

what i did is the below:

vals.update({
'name': name,
'date_departure': datetime_departure,
'date_arrival': datetime_arrival
})
service = super(ServiceClass, self).create(vals)

and save the service id like this:

services.append((0, 0, service_id.id))

and finally return the services list. like this:

return services

so, when I save, it returns: AttributeError: 'list' object has no attribute 'id'

Can you please provide any solution? Thanks in advanced

0
Avatar
Cancelar
Avatar
Ibrahim Boudmir
Melhor resposta

Hi, 

services.append((4, service.id, 0))
note that :
  • (0, _, values) adds a new record created from the provided value dict.
  • (4, id, _) adds an existing record of id id to the set

in your case, you create a service and want to add it to a list of services.

1
Avatar
Cancelar
Osmani
Autor

Thanks for answering my question I really appreciated it.

Look, what i have in my code now including your solution is :

for values in range(1, 7, 2):

if values > 1:

datetime_departure = datetime_departure + timedelta(

days=1)

datetime_arrival = datetime_arrival + timedelta(

days=1)

vals.update({

'name': name,

'date_departure': datetime_departure,

'date_arrival': datetime_arrival

})

service_id = super(ServiceClass, self).create(vals)

services.append((4, service_id.id, 0))

But, it doesn't work.

Ibrahim Boudmir

print '00', services

services.append((4, service_id.id, 0))

print '11', services

can you tell me the output ?

Osmani
Autor

Thanks again for the answer.

When finally the function ends, it returns this: [(4, 48, 0), (4, 49, 0), (4, 50, 0)]

that is the final output doing return services

But, id I do return service_id like you suggest, it doesn't return the last id? and what i need is that it returns all the created ids.

Thanks

Ibrahim Boudmir

In ORM functions, you always need to return the super. to keep other calls from the function, otherwise it may break other treatments.

to give u a relevant answer, can you tell me why you need services ? in what case you use the data from services ?

Osmani
Autor

Ok. I have a previous view wich has a One2many field. So, when I create an instance of that model(the One2many) it will be created as many times as the value of a field that the user introduces. For example, in the model there is a field called frequency, if frequency=3 I need that that model creates 3 times itself and in the tree of the One2many show those 3 records. Hope you understand... Thanks again for your time.

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
AttributeError : Field does not exist
attributeerror odooV8 declaration
Avatar
Avatar
Avatar
2
mar. 16
7859
AttributeError: 'bool' object has no attribute '_setup_fields' Resolvido
attributeerror bool odooV8
Avatar
Avatar
2
jan. 24
15261
CONFIGURACION DE CORREO PROPIO POR PRUMERA VEZ
odooV8
Avatar
0
mar. 25
2000
How to remove model if not in the py files anymore
odooV8
Avatar
0
jan. 25
4256
Start odoo server automatically in Ubuntu 14.04 on reboot Resolvido
odooV8
Avatar
Avatar
1
ago. 23
15880
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