コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    製品デモを利用する
  • 料金
  • ヘルプ

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

  • CRM
  • e-Commerce
  • 会計
  • 在庫
  • PoS
  • プロジェクト
  • MRP
All apps
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
ヘルプ

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

購読

この投稿に活動があった際に通知を受け取ります

この質問にフラグが付けられました
nonetypeattributeerrornoattribute
3 返信
39364 ビュー
アバター
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
アバター
破棄
アバター
Borni DHIFI
最善の回答

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
アバター
破棄
Victorien
著作者

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
著作者

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
著作者

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

アバター
ClueLogics Technologies Pvt. Ltd.
最善の回答

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
アバター
破棄
Victorien
著作者

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

Victorien
著作者

I would like to bring up the buttons.

ClueLogics Technologies Pvt. Ltd.

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

アバター
Victorien
著作者 最善の回答

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
アバター
破棄
Victorien
著作者

IT'S OK ! :) very thanks

Victorien
著作者

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
著作者

How to reference "ir.ui.view"?

Borni DHIFI

my skype : dhifi.borni

ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
OpenERP Server Error AttributeError: 'NoneType' object has no attribute 'exists'
nonetype attributeerror exists
アバター
アバター
アバター
アバター
6
6月 18
14128
AttributeError: 'str' object has no attribute 'iteritems'
error attributeerror noattribute str
アバター
アバター
2
6月 17
9960
AttributeError: 'NoneType' object has no attribute 'search'
search nonetype openerp7 attributeerror
アバター
アバター
1
12月 15
7364
[SOLVED] AttributeError: 'ir.model.fields' object has no attribute '_get_id' 解決済
attributeerror
アバター
アバター
1
2月 23
13181
AttributeError: 'int' object has no attribute 'id'
attributeerror
アバター
0
12月 15
7211
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • Github
  • Runbot
  • 翻訳
サービス
  • Odoo.shホスティング
  • サポート
  • アップグレード
  • カスタム開発
  • 教育プログラム
  • 会計事務所一覧
  • パートナー一覧
  • パートナーになる
企業情報
  • 会社概要
  • ブランドアセット
  • お問い合わせ
  • 採用情報
  • イベント
  • ポッドキャスト
  • ブログ
  • お客様一覧
  • リーガル情報 • プライバシーポリシー
  • セキュリティ
الْعَرَبيّة 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(オドゥー)は、CRM、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

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