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

AttributeError: 'NoneType' object has no attribute '_name'

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
nonetypeattributeerrornoattribute
3 Respostas
39375 Visualizações
Avatar
Victorien

Hello,

I am a French student. I want test mymod, for workflow.

But I have this error :

AttributeError: 'NoneType' object has no attribute '_name'

mymod.py

# -*- coding: utf-8 -*-
from osv import fields, osv

def mymod_new(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'new' })
     return True

def mymod_assigned(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'assigned' })
     return True

def mymod_negotiation(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'negotiation' })
     return True

def mymod_won(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'won' })
     return True

def mymod_lost(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'lost' })
     return True

class mymod(osv.osv):
    _name = "mymod.mymod"
    _description = "mymod"
    _columns = { 
    'name' : fields.char("names",),
    'state': fields.selection([
    ('new','New'),
    ('assigned','Assigned'),
    ('negotiation','Negotiation'),
    ('won','Won'),
    ('lost','Lost')], 'Stage', readonly=True),
    }

mymod_workflow.xml

 <?xml version="1.0" encoding="utf-8"?>
    <openerp>
        <data>
            <record model="workflow" id="wkf_mymod">
                <field name="name">mymod.wkf</field>
                <field name="osv">mymod.mymod</field>
                <field name="on_create">True</field>
            </record>
            <record model="workflow.activity" id="act_new">
                <field name="wkf_id" ref="wkf_mymod" />
                <field name="flow_start">True</field>
                <field name="name">new</field>
                <field name="kind">function</field>
                <field name="action">mymod_new()</field>
            </record>

            <record model="workflow.activity" id="act_assigned">
                <field name="wkf_id" ref="wkf_mymod" />
                <field name="name">assigned</field>
                <field name="kind">function</field>
                <field name="action">mymod_assigned()</field>
            </record>

            <record model="workflow.activity" id="act_negotiation">
                <field name="wkf_id" ref="wkf_mymod" />
                <field name="name">negotiation</field>
                <field name="kind">function</field>
                <field name="action">mymod_negotiation()</field>
            </record>

            <record model="workflow.activity" id="act_won">
                <field name="wkf_id" ref="wkf_mymod" />
                <field name="name">won</field>
                <field name="kind">function</field>
                <field name="action">mymod_won()</field>
                <field name="flow_stop">True</field>
            </record>

            <record model="workflow.activity" id="act_lost">
                <field name="wkf_id" ref="wkf_mymod" />
                <field name="name">lost</field>
                <field name="kind">function</field>
                <field name="action">mymod_lost()</field>
                <field name="flow_stop">True</field>
            </record>
            <record model="workflow.transition" id="t1">
                <field name="act_from" ref="act_new" />
                <field name="act_to" ref="act_assigned" />
                <field name="signal">mymod_assigned</field>
            </record>

            <record model="workflow.transition" id="t2">
                <field name="act_from" ref="act_assigned" />
                <field name="act_to" ref="act_negotiation" />
                <field name="signal">mymod_negotiation</field>
            </record>

            <record model="workflow.transition" id="t3">
                <field name="act_from" ref="act_negotiation" />
                <field name="act_to" ref="act_won" />
                <field name="signal">mymod_won</field>
            </record>

            <record model="workflow.transition" id="t4">
                <field name="act_from" ref="act_negotiation" />
                <field name="act_to" ref="act_lost" />
                <field name="signal">mymod_lost</field>
            </record>
        </data>
    </openerp>

mymod_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="mymod_form" model="ir.ui.view">
            <field name="name">mymod.form</field>
            I think ERROR IT'S HERE :
                    <field name="model">mymod.mymod</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="nom_form">
                <separator string="Workflow Actions" colspan="4"/>
                <group colspan="4" col="3">
                    <button name="mymod_assigned" string="Assigned" states="new" />
                    <button name="mymod_negotiation" string="In Negotiation" states="assigned" />
                    <button name="mymod_won" string="Won" states="negotiating" />
                    <button name="mymod_lost" string="Lost" states="negotiating" />
                </group>
                </form>
            </field>
        </record>
        <menuitem name="Menu_Work" icon="terp-project" id="dev_menu" />
        <menuitem name="Workflow" parent="dev_menu" id="dev_menu_person" />
        <menuitem name="Boutton" parent="dev_menu_person" id="view_partner_form" action="mymod_form" />
    </data>
</openerp>

Thanks for your help.

1
Avatar
Cancelar
Avatar
Borni DHIFI
Melhor resposta

Hi, your problem it is in the line :

<menuitem name="Boutton" parent="dev_menu_person" id="view_partner_form" action="mymod_form" />

action="mymod_form" must reference in record of type ir.actions.act_window

so add this record :

   <record model="ir.actions.act_window" id="action_mymod_form">
        <field name="name">Workflow</field>
        <field name="res_model">mymod.mymod</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
    </record>   
  <menuitem name="Boutton" parent="dev_menu_person" id="view_partner_form" action="action_mymod_form" />
1
Avatar
Cancelar
Victorien
Autor

Thx for your help.

But I have this error : Integrity Error

The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it - creation/update: a mandatory field is not correctly set

[object with reference: res_model - res.model]

Victorien
Autor

In French : Erreur d'intégrité

L'opération n'a pas pu être terminée, probablement à la suite d'une : - suppression : vous avez essayer de supprimer un enregistrement auquel d'autres enregistrements font référence - création/modification : un champ requis n'a pas été correctement rempli

[objet ayant pour référence : res_model - res.model]

Borni DHIFI

test your module a new database . and see this subject http://help.openerp.com/question/16336/how-i-can-create-module-openerp-7/ . you can help you

Victorien
Autor

It's OK. But I have error : ValueError: No such external ID currently defined in the system: mymod.mymod_form

Avatar
ClueLogics Technologies Pvt. Ltd.
Melhor resposta

Hi

there is also a problem in you field declration for charater field we size is must so plz use

          'name' : fields.char("names",size=100),

other wise another error will be there

Thanks
Sandeep

3
Avatar
Cancelar
Victorien
Autor

Thanks, but if we size, I have this error : TypeError: VARCHAR parameter should be an int, got <type 'str'>

Victorien
Autor

I would like to bring up the buttons.

ClueLogics Technologies Pvt. Ltd.

size must be in integer like size=100 not size="100"

Avatar
Victorien
Autor Melhor resposta

Sorry I started on openerp, I just want to display the buttons but I do not know how.

mymod.py

# -*- coding: utf-8 -*- from osv import fields, osv



def mymod_new(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'new' })
     return True

def mymod_assigned(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'assigned' })
     return True

def mymod_negotiation(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'negotiation' })
     return True

def mymod_won(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'won' })
     return True

def mymod_lost(self, cr, uid, ids):
     self.write(cr, uid, ids, { 'state' : 'lost' })
     return True

class mymod(osv.osv):
    _name = "mymod.mymod"
    _description = "mymod"
    _columns = { 
    'state': fields.selection([
    ('new','New'),
    ('assigned','Assigned'),
    ('negotiation','Negotiation'),
    ('won','Won'),
    ('lost','Lost')], 'Stage', readonly=True),
    }
    _defaults = { 'state': 'new',}

mymod_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record model="ir.ui.view" id="mymod_tree">
        <field name="name">mymod.tree</field>
        <field name="model">mymod</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
        <separator string="Workflow Actions" colspan="4"/>
        <group colspan="1" col="1">
            <button name="mymod_assigned" string="Assigned" states="new" />
            <button name="mymod_negotiation" string="In Negotiation" states="assigned" />
            <button name="mymod_won" string="Won" states="negotiating" />
            <button name="mymod_lost" string="Lost" states="negotiating" />
        </group>
        </field>
        </record>

        <menuitem name="Menu_Work" icon="terp-project" id="dev_menu" />
        <menuitem name="Workflow" parent="dev_menu" id="dev_menu_person" />
        <menuitem name="Boutton" parent="dev_menu_person" id="view_partner_form" action="mymod_tree" />
    </data>
</openerp>
0
Avatar
Cancelar
Victorien
Autor

IT'S OK ! :) very thanks

Victorien
Autor

But my buttons do not appear :(

Borni DHIFI

many errors in your code. the record form should be type ir.ui.view and not ir.actions.act_window because menuitem name="Boutton" should be reference to record action and not record form.

in your model mymod add defualt state to display first button _defaults = { 'state':'new',}

and others...

Victorien
Autor

How to reference "ir.ui.view"?

Borni DHIFI

my skype : dhifi.borni

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
OpenERP Server Error AttributeError: 'NoneType' object has no attribute 'exists'
nonetype attributeerror exists
Avatar
Avatar
Avatar
Avatar
6
jun. 18
14134
AttributeError: 'str' object has no attribute 'iteritems'
error attributeerror noattribute str
Avatar
Avatar
2
jun. 17
9972
AttributeError: 'NoneType' object has no attribute 'search'
search nonetype openerp7 attributeerror
Avatar
Avatar
1
dez. 15
7378
[SOLVED] AttributeError: 'ir.model.fields' object has no attribute '_get_id' Resolvido
attributeerror
Avatar
Avatar
1
fev. 23
13190
AttributeError: 'int' object has no attribute 'id'
attributeerror
Avatar
0
dez. 15
7222
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