تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (BI)
    • المستندات
    • توقيع إلكتروني
    المبيعات
    • إدارة علاقات العملاء
    • المبيعات
    • نقطة البيع للمتاجر
    • نقطة البيع للمطاعم
    • الاشتراكات
    • تأجير
    المواقع الإلكترونية
    • أداة بناء المواقع الإلكترونية
    • متاجر إلكترونية
    • مدونة
    • المنتدى
    • دردشة مباشرة
    • التعليم الإلكتروني
    سلسلة التوريد
    • المستودعات
    • التصنيع
    • إدارة دورة حياة المنتج
    • المشتريات
    • الصيانة
    • الجودة
    الموارد البشرية
    • موظفون
    • التوظيف
    • إجازة عمل
    • التقييمات
    • الإحالات
    • تطبيق الأسطول
    التسويق
    • التسويق الإجتماعي
    • التسويق عبر البريد الإلكتروني
    • التسويق عبر الرسائل النصية
    • فعاليات
    • أتمتة التسويق
    • الاستطلاعات
    الخدمات
    • المشاريع
    • الجداول الزمنية
    • الخدمة الميدانية
    • مكتب المساعدة
    • التخطيط
    • مواعيد
    اﻹنتاجية
    • مناقشة
    • الموافقات
    • إنترنت الأشياء "IoT"
    • بروتوكول ربط المحادثات الصوتية عبر الإنترنت
    • المعرفة
    • WhatsApp
    التطبيقات الخارجية ستوديو أودو منصة أودو السحابية
  • قطاعات الأعمال
    البيع بالتجزئة
    • متجر كتب
    • متجر ملابس
    • متجر أثاث
    • متجر بقالة
    • متجر معدات
    • متجر ألعاب
    الطعام والضيافة
    • بار وحانة
    • المطعم
    • مطعم للوجبات السريعة
    • نزل للضيوف
    • موزّع مشروبات
    • فندق
    العقارات
    • وكالة عقارات
    • شركة هندسة معمارية
    • البناء
    • إدارة العقارات
    • العناية بالحدائق
    • اتحاد مُلاّك العقارات
    استشارة
    • مؤسسة محاسبية
    • شريك أودو
    • وكالة تسويقية
    • منشأة قانونية
    • استقطاب المواهب
    • التدقيق والتوثيق
    التصنيع
    • الأقمشة
    • معدني
    • الأثاث
    • الطعام
    • مصنع خمور
    • هدايا الشركات
    الصحة واللياقة البدنية
    • نادي رياضي
    • متجر نظارات
    • مركز لياقة بدنية
    • الممارسون الصحيون
    • صيدلية
    • صالون تصفيف الشعر
    التجارة
    • عامل صيانة
    • الأجهزة والمعدات التقنية ودعمها
    • أنظمة الطاقة الشمسية
    • صانع أحذية
    • خدمات التنظيف
    • خدمات التكييف (HVAC)
    غير ذلك
    • منظمة غير ربحية
    • وكالة بيئية
    • تأجير لوحات إعلانية
    • تصوير
    • تأجير دراجات
    • بائع وسيط للبرمجيات
    تصفح كافة قطاعات الأعمال
  • مجتمع أودو
    تعلم
    • دروس
    • التوثيق
    • شهادات
    • التدريب
    • مدونة
    • بودكاست
    قم بتعزيز التعليم
    • برنامج تعليم
    • Scale UP! لعبة الأعمال
    • قم بزيارة أودو
    احصل على البرنامج
    • تحميل
    • قارنْ الإصدارات
    • إطلاق
    تعاون
    • جيت هاب "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:

  • إدارة علاقات العملاء
  • 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 الردود
1981 أدوات العرض
الصورة الرمزية
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
مارس 24
2289
Odoo owl
owl OWL
الصورة الرمزية
0
أكتوبر 22
2478
How to inherit owl template and qweb in custom module V17.0? تم الحل
manufacturing owl OWL
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
مايو 25
5623
Patching Owl Service Function
javascript owl OWL
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
أكتوبر 23
6397
Skills needed for Odoo OWL Development ?
OWL
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
2
سبتمبر 25
2524
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "Github"
  • المشغل الآلي رنبوت
  • الترجمات
خدماتنا
  • استضافة أودو إس إتش
  • الدعم
  • الترقية
  • التطويرات المخصصة
  • التعليم
  • اعثر على محاسب
  • اعثر على شريك
  • كنْ شريكاً
معلومات عنا
  • شركتنا
  • أصول العلامة التجارية
  • اتصلْ بنا
  • الوظائف
  • فعاليات
  • بودكاست
  • مدونة
  • عملاء
  • قانوني • الخصوصية
  • الحماية
الْعَرَبيّة 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

أودو هو عبارة عن مجموعة من تطبيقات الأعمال مفتوحة المصدر التي تغطي جميع احتياجات شركتك، مثل: إدارة علاقات العملاء والتجارة الإلكترونية والمحاسبة والمخزون ونقاط البيع وإدارة المشاريع وما إلى ذلك.

ما يجعل من أودو مميزاً هو هدفه بأن يكون سهل الاستخدام للغاية ومتكاملاً تمامًا في الوقت ذاته.

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