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

Odoo project task tags domain

購読

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

この質問にフラグが付けられました
1 返信
4802 ビュー
アバター
Willmore BattleShipNet

Project task can have many tags. Now when the user creates a task he can choose from all tags. But he wants to be able to choose tags only from those tags that are used for that project. 


What domain rule should I have on the field "tag" (on the form) to let user when creating new project task to see (and eventually to choose) only those tags that are used in the project the user creates task for?

2
アバター
破棄
アバター
Sudhir Arya (ERP Harbor Consulting Services)
最善の回答

You can do this from the onchange of the project and return the domain.

Ex:

api.onchange('project_id')
def onchange_project(self):
    tag_ids = []
    if self.project_id:
        for task in self.project_id.task_ids:
            tag_ids += task.tag_ids.ids
    return {'domain': {'tag_ids': [('id', 'in', tag_ids)]}}
Sudhir Arya
ERP Harbor Consulting Services
Skype:sudhir@erpharbor.com
Website: http://www.erpharbor.com
6
アバター
破棄
Willmore BattleShipNet
著作者

Thank you. I tried but got error. What can be wrong with that approach?

I have the following code

class InheritedProjectTask(models.Model):

"""docstring"""

_inherit = 'project.task'

@api.onchange('project_id')

def onchange_project(self):

"""docstring"""

tag_ids = []

if self.project_id:

tag_ids += [task.tag_ids.ids for task in self.project_id.task_ids]

return {'domain': {'tag_ids': [('id', 'in', tag_ids)]}}

With this code installed. I open a Project and click "Create" to open a Task creation form (form for new "project.task" model's object). On that form I click on drop-down "Tags" to list possible "Tags" for the project ("possible tags for the project" are all tags that are used on any of the task of the project the task is created for). And then I get error:

> res = self._obj.execute(query, params)

>

> TypeError: not all arguments converted during string formatting

on the console I see the error

> INFO DB odoo.sql_db: bad query: SELECT "project_tags".id FROM "project_tags" WHERE (("project_tags"."id" in (%s,%s,%s,%s,%s,%s,%s,%s)) AND (("project_tags"."id" not in (%s)) OR "project_tags"."id" IS NULL)) ORDER BY "project_tags"."id" limit 8

2018-08-03 10:40:20,476 12978 ERROR DB odoo.http: Exception during JSON request handling.

What did I do wrong in the code?

Sudhir Arya (ERP Harbor Consulting Services)

See my updated code in answer. It should work now.

Willmore BattleShipNet
著作者

Thank You very much for the proposed solution! I would not come to that in near time! :) But after applying it I can see on the "Tags" field (in debug mode when I hover over "Tags" drop down) that effective Domain is id, in,4,5,6,7,8,9,10,11,12,13,14,18,19,20,22,23,24,25,26,27,28,5,4,5,35 . And that is the problem: it doesn't really take tags from just this project's tasks. Tags from other projetcs tasks appear too which is unwanted. How this can be that all tags are included not just those from tasks of the current project?

Sudhir Arya (ERP Harbor Consulting Services)

It will only show all the tags which are used in the tasks of selected project.

Willmore BattleShipNet
著作者

It is really strange. I do the following: 1) Open "Projects". 2) Click "Create" 3) Create a project with a name "Really new project". 4) I open project "Really new project" tasks window. This window is empty as we didn't create any tasks yet. 5) I click "Create" and a form to create new task appears. 6) I enter task title "This is really new task in a really new project" . 7) In the field "Tags" I click with mouse and drop-down appears with text "No results to show" and I enter "1234657890" (this tag name is never used anywhere so it's completely new tag). I click "Create 1234657890" for this tag to be created and it appears in "Tags" field. So far so good. 8) I press "Save" on the task so that the new record is saved. Task is saved and on the form appears a button "Edit". 9) without reloading a page I click "Edit" and click on the "Tags" for drop-down to appear. Drop-down appears and it contains text "No results to show" (this is good because there are no more tags in that project to be selected because we have not created any other tags). I type "qqq" in "Tags" and create this tag, then on the task form I press "Save" to save that task. Then I navigate to any other project (let's say I navigate to **Another project**) and open one of project's tasks just to see it. And then I navigate to the project "Really new project" and press "Edit" and click "Tags" and I see all the tags appear from other project's. Why?

What I have noticed. If I go to any project (project1) and open a task of it then navigate to another project (project2) and click "Create" to create new task for the project2 then on "Tags" there will be only tags from project1 tasks (as we want) it seems that domain works. BUT if I go to any project (project1) and open a task of it then navigate to another project (project2) and click "Edit" to edit a task (of the project2) then on "Tags" there will be ALL TAGS (as if domain was ineffective). How is that possible?

I have noticed (from looking at the console output) that method onchange is called only when I click "Create" on the task. So I have troubles when I want to edit task because onchange is not called and all tags show up :(.

Is there anything else I could add besides onchange to make domain apply all the time.

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

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

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