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

Custom code: Can clicking on a Task with Subtasks (in Kanban View) open another Kanban with the Subtasks?

購読

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

この質問にフラグが付けられました
owlOWL
2 返信
2013 ビュー
アバター
Santiago Carbonell Forment

Hi,


I have a question about how to manage a project requirement:


A client uses the projects module in Odoo 16 with tasks and subtasks. They asked me as a requirement that, in the task kanban, when clicking on a task that has subtasks, instead of opening the form with the task data, a Kanban with the subtasks of the parent task should reopen.


I understand that this requirement must be implemented with Owl, but I can't get it to work. In fact, I can't inherit the Kanban view from the tasks and change the on-click behavior to change the functionality. Do you have any examples of how to inherit a Kanban and change the on-click using Owl?


Thank you


Best regards.

0
アバター
破棄
アバター
Sufiyan Muzaffar Shaikh (smsh)
最善の回答

Hello Santiago Carbonell Forment,


You cannot inherit the KanbanRecord template directly because it is an OWL template.

This means you cannot inherit it using a regular: <odoo><template inherit_id="..."></template></odoo> since that only works for backend QWeb views.


✅ Instead, you can either directly replace the template or patch the existing onClick function.


I’ve attached the code which directly opens the Kanban view of Subtasks, you just have change the module name.


```import { patch } from '@web/core/utils/patch';

import { KanbanRecord } from '@web/views/kanban/kanban_record';


export const CANCEL_GLOBAL_CLICK = ["a", ".dropdown", ".oe_kanban_action", "[data-bs-toggle]"].join(

    ","

);

patch(KanbanRecord.prototype, 'my_module.KanbanRecord', {

        onGlobalClick(ev) {

            const { archInfo, forceGlobalClick, openRecord, record } = this.props;

            console.log("Called", record.data)

            if (record.data.child_text != false) {

                this.env.services.action.doAction({

                    type: 'ir.actions.act_window',

                    name: 'Subtasks',

                    res_model: 'project.task',

                    domain: [['parent_id', '=', record.resId]],

                    view_mode: 'kanban',

                    views: [[false, 'kanban']],

                    target: 'current',

                });

            }

            else {

                if (ev.target.closest(CANCEL_GLOBAL_CLICK)) {

                    return;

                }

                if (!forceGlobalClick && archInfo.openAction) {

                    this.action.doActionButton({

                        name: archInfo.openAction.action,

                        type: archInfo.openAction.type,

                        resModel: record.resModel,

                        resId: record.resId,

                        resIds: record.resIds,

                        context: record.context,

                        onClose: async () => {

                            await record.model.root.load();

                            record.model.notify();

                        },

                    });

                } else if (forceGlobalClick || this.allowGlobalClick) {

                    openRecord(record);

                }

            }

        },


}); ```

⚠️ Please note: this code is only for reference purposes.

If you patch the onClick method, it will change the behavior across all kanban views in Odoo, so you need to handle it carefully and test every case where a kanban view is used.


❓ If you implement this then how user will open the parent task?

0
アバター
破棄
Santiago Carbonell Forment
著作者

Hello Sufiyan Muzaffar Shaikh

I haven't written to you before because I had to take a rushed Owl course in Odoo because understanding this whole new environment is complicated, and I wanted to understand what you sent me.

Congratulations! This is by far the best answer I've received, and now I think I understand. In fact, the problem isn't the projects module, but rather that the onclick is actually in the base web module, and it's from there that you have to inherit. Also, you have to change that onGlobalClick method, which I've been looking for, and not just onclick. It's huge and indeed complicated to update because it actually affects many modules such as CRM, Project, HR, Employee, etc.

I don't know if there's a simple way with parent or super to have the onGlobalClick inherit everything from the parent module, and I just add my code, although I don't think it would work well.

Thinking about it, it might be simpler to use doubleClick or rightClick instead of onGlobalClick, which I don't think are used, and detect the model using, for example, record.data.tag_ids.parentRecord.resModel, where I can see if it's a project or a task and decide based on that.

I'm a little new to Owl. Do you know if I can add a rightClick event to do this?

Thank you very much.

アバター
D Enterprise
最善の回答

Here,

Create a JS File : project_task_kanban_patch.js

/** @odoo -module **/ import { patch } from "@web/core/utils/patch" ; import { KanbanRecord } from "@web/views/kanban/kanban_record/kanban_record" ; import { useService } from "@web/core/utils/hooks" ; patch ( KanbanRecord . prototype , { setup ( ) { super . setup (); this . action = useService ( "action" ); }, async onRecordClick ( ev ) { const record = this . props . record . data ; // If task has subtasks, open them in Kanban if ( this . props . record . model === "project.task" && record. child_ids . length > 0 ) { house. preventDefault (); await this . action . doAction ({ type : "ir.actions.act_window" , name : `Subtasks of ${record.name} `, res_model : "project.task" , view_mode : "kanban,form" , domain : [[ "id" , "in" , record. child_ids ]], context : { default_parent_id : record. id }, target : "current" , }); return ; } // Otherwise, use default behavior await super . onRecordClick (home); }, });

Include in Manifest

In your __manifest__.py :

"assets" : { "web.assets_backend" : [ "your_module/static/src/js/project_task_kanban_patch.js" , ], },

Ensure child_ids is in the Kanban view

Add this in XML:

<record id = "project.task.kanban.view.inherit" model="ir.ui.view"> <field name = "model" >project.task </field> <field name = "inherit_id" ref ="project.view_task_kanban"/> <field name = "arch" type = "xml"> <field name = "name" position = "before"> <field name = "child_ids"/> </field> </field> </record> ​

i hope it is usefull

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

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

登録
関連投稿 返信 ビュー 活動
Alter existing owl app
owl OWL
アバター
アバター
1
3月 24
2315
Odoo owl
owl OWL
アバター
0
10月 22
2495
How to inherit owl template and qweb in custom module V17.0? 解決済
manufacturing owl OWL
アバター
アバター
アバター
3
5月 25
5650
Patching Owl Service Function
javascript owl OWL
アバター
アバター
アバター
3
10月 23
6425
Skills needed for Odoo OWL Development ?
OWL
アバター
アバター
アバター
2
9月 25
2540
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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