コンテンツへスキップ
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
このフォーラムについて
ヘルプ

How to create selection that shows all incoming e-mail titles?

購読

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

この質問にフラグが付けられました
1 返信
4429 ビュー
アバター
Yenthe Van Ginneken (Mainframe Monkey)

Hi guys

I would love to be able to get all e-mails that are sent to Odoo (so incoming on Odoo) in a dropdown in the project view. I then want to create a dropdown where the user can see every title of an email, choose one and save it on a project. The idea is that the user can also directly click on the item and that it opens up the correct e-mail.

Is this possible and how should I do it?
I assume it is possible since you have the model 'mail.mail' which contains all e-mails and you can fetch them in the view?

What I tried so far is to add a new field on the form from project_view.xml (<record id="edit_project" model="ir.ui.view">) by doing so:

<group col="4">
                            <field name="user_id" string="Project Manager"
                                    attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"
                                    context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'project.group_project_manager']}"/>
                            <newline/>
                            <field name="partner_id" on_change="onchange_partner_id(partner_id)" string="Customer"/>
                <newline/>
               <field name="email_id" on_change="onchange_email_id(email_id)" string="Emails"/>
                        </group>

I then created the new field email_id in project.py in the columns = {} under the class project like this:

fields = {
//Lots of irrelevant code

'state': fields.selection([('template', 'Template'),
                                   ('draft','New'),
                                   ('open','In Progress'),
                                   ('cancelled', 'Cancelled'),
                                   ('pending','Pending'),
                                   ('close','Closed')],
                                  'Status', required=True, copy=False),
        'doc_count': fields.function(
            _get_attached_docs, string="Number of documents attached", type='integer'
        ),
        'email_id': fields.many2one(
            'mail.mail', '??', help='This holds all e-mails that you recieved.'),

     }

And finally in project.py I created an on_change function like this:

    def onchange_email_id(self, cr, uid, ids, part=False, context=None):
        email_obj = self.pool.get('mail.mail')
        return {'value': email_obj}

Everything looks pretty good but I get one more error when I want to create / modify a project:

 

So what am I doing wrong or am I missing?
Yenthe

1
アバター
破棄
アバター
Ivan
最善の回答

Why don't you use many2one field instead?  With the proper domain I believe it can achieve what you need.
Your many2one should look like this:

'email_id': fields.many2one(
            'mail.mail', '--', help='This holds all e-mails that you recieved.'),

Your XML like this (with a domain that filters on received e-mails):

<field name="email_id" on_change="onchange_email_id(email_id)" string="Emails" domain="[('state','=','Received')]"/>

1
アバター
破棄
Yenthe Van Ginneken (Mainframe Monkey)
著作者

Hmm good idea Ivan! I actually created a many2one field, like you suggested. 'email_id': fields.many2one( 'mail.mail', '??', help="This holds all e-mails that you recieved.'), so how can I filter this to only show e-mails that are recieved in Odoo and not sent? If I have that I'm almost done..

Ivan

mail.mail has a state field that can be ('outgoing', 'Outgoing'), ('sent', 'Sent'), ('received', 'Received'), ('exception', 'Delivery Failed'), ('cancel', 'Cancelled'). Maybe you can use that to filter incoming mails?

Yenthe Van Ginneken (Mainframe Monkey)
著作者

So how can I apply this in a domain / filter? I honestly haven't ever used them..

Ivan

You have 2 options, AFAIK, put the domain in the field definition, something like: 'email_id': fields.many2one('mail.mail', 'ee', domain=[('state', 'in', [list of the states])], required=True, copy=False). Or you can put it in the view: <field name="email_id" domain="[('state', 'in', [list of the states])]" string="Emails"/>

Yenthe Van Ginneken (Mainframe Monkey)
著作者

domain="[('state','=','received')]" seems to do the job perfect. I only have one error remaining,. I'll update my question for this, could you have a look at this in a few minutes please? I'll accept your answer afterwards.

Ivan

You seemed to inherit from model.Models but code using the old API way. Try to inherit from orm.Model instead?

Ivan

Is that (inheriting model.Models) it?

Yenthe Van Ginneken (Mainframe Monkey)
著作者

@Ivan I tried importing both at the top and this gives me the error from openerp import model.Models ^ SyntaxError: invalid syntax But I'm not sure how this would be related to this error? :s How could I alternatively fix this or do this in V8 code?

Yenthe Van Ginneken (Mainframe Monkey)
著作者

I had another fields.many2one which was screwing things up, so my bad! Its working perfect now. Is it okay that I update your answer with the final result? Then its a honest 'accepted' answer. I don't know who accepted it yet so :)

Ivan

No, it does not. You should be importing models instead: from openerp import models, fields, api, _. Usually you just inherit the class from models.Model not from the Model itself. I'm not well versed in v8 API. Sorry, I also missed that you used fields instead of _column. fields is a keyword in OpenERP. Maybe that is the cause.

Ivan

Yup. Go ahead.

Yenthe Van Ginneken (Mainframe Monkey)
著作者

Added my code in your answer. Alright thanks for the help Ivan! Upvoted & accepted.

Ivan

Pleasure to help.

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

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

登録
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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