Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

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

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
nonetypeattributeerrornoattribute
3 Odpowiedzi
39352 Widoki
Awatar
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
Awatar
Odrzuć
Awatar
Borni DHIFI
Najlepsza odpowiedź

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
Awatar
Odrzuć
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

Awatar
ClueLogics Technologies Pvt. Ltd.
Najlepsza odpowiedź

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
Awatar
Odrzuć
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"

Awatar
Victorien
Autor Najlepsza odpowiedź

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
Awatar
Odrzuć
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

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
OpenERP Server Error AttributeError: 'NoneType' object has no attribute 'exists'
nonetype attributeerror exists
Awatar
Awatar
Awatar
Awatar
6
cze 18
14121
AttributeError: 'str' object has no attribute 'iteritems'
error attributeerror noattribute str
Awatar
Awatar
2
cze 17
9953
AttributeError: 'NoneType' object has no attribute 'search'
search nonetype openerp7 attributeerror
Awatar
Awatar
1
gru 15
7362
[SOLVED] AttributeError: 'ir.model.fields' object has no attribute '_get_id' Rozwiązane
attributeerror
Awatar
Awatar
1
lut 23
13173
AttributeError: 'int' object has no attribute 'id'
attributeerror
Awatar
0
gru 15
7203
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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