تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (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
حول هذا المنتدى
المساعدة

Modules - Order of dependencies

اشتراك

تسلم الإشعارات عندما يكون هناك نشاط في هذا المنشور

لقد تم الإبلاغ عن هذا السؤال
modulesdependencies
1 الرد
11655 أدوات العرض
الصورة الرمزية
Alf Olsen

I can't find any information about the order of dependencies when installing modules. I'm talking about the case where you don't specify any dependencies in __manifest__, just install the modules in some (random) order.

This is a big deal when it comes to overriding class methods and properties both in python and javascript.

Example: Lets say I have 2 modules that each override a method in res.partner, something like the code below.

Which one will run first? And what happens if you update the module that don't run first?

class ResPartner(models.Model):
    _inherit = 'res.partner'
    @api.model_cr
    def init(self):
        super(ResPartner, self).init()
        # some custom code


1
الصورة الرمزية
إهمال
Alf Olsen
الكاتب

Sorry about the formating, the editor kind of suck..

الصورة الرمزية
Richard
أفضل إجابة

The short answer is, without explicitly listing dependencies, there is no guarantee of order.

The process builds a tree and ensures that anything with explicit dependencies to be not processed until all its dependencies are done.  So, two "siblings" will have a similar ranking, and it will have more to do with order it comes back from sql in ir_module_module, which cannot be relied upon.

When you "update" it will only update that module, and anything that depends upon it, meaning that an unrelated module will not "update".

This is exactly why it is poor form to inherit a method and overwrite code without good super calls.

res_partner

    def xxx(self):

        return self.field1 == desired_val


res_partner in module X

     def xxx(self):

         if self.block_xxx:

              return False

          return super().xxx()

and res_partner in module Y

      def xxx(self):

          return True


If module X code is loaded before module Y, then the result will always be True

If module Y code is loaded before module X, then the result will be False if self.block_xxx, otherwise it will be True.

And there is no guarantee that the behaviour will be consistent from one install to the next.

  

1
الصورة الرمزية
إهمال
Jérôme Thériault

Your answer is on time Richard, I was just looking into this ;)

So this line illustrates that there is no defined order in which modules are loaded:

cr.execute("SELECT name from ir_module_module WHERE state IN %s" ,(tuple(states),))

https://github.com/odoo/odoo/blob/def7d7bb0231fef38e044803b245c9b990a90216/odoo/modules/loading.py#L340

Bummer... I have a case where I'd like to override res_partner.xxx() so all other known and unknown modules benefit from it. Odoo has implemented a "priority" field for views but it looks like they have not for models.

Richard

Ahh, this gets tricky. If they all call super correctly, then they may benefit, depending on what they do (or if they completely override)

Effectively, to be sure, you need to set a dependency(ies) or take your chances.

We have, at times, needed 3, 4, or more modules to achieve what would be nice to do in 1.

module res_partner_xxx depends on crm

res_partner_xxx_sale depends on res_partner_xxx and sale and auto installed, and only has a few lines of code

res_partner_xxx_purchase

res_partner_xxx_yyyy

etc.

Richard

And, even if the read from sql could guarantee an order (like alphabetically), the tree and dependency calcs push them around as lists, recordsets, joining and unioning - it would be foolish to trust any sequence would remain intact without any explicit code to ensure it.

هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!

أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
How to have many2one/one2many relation between models from two different modules
modules dependencies v15
الصورة الرمزية
الصورة الرمزية
1
يوليو 22
5609
Nuevo menú en "CRM"
modules
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
يوليو 25
2721
Allow Access to update module
modules
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
مايو 25
4591
Mozaik dependencies
dependencies
الصورة الرمزية
الصورة الرمزية
2
يوليو 24
2028
Dependency priorities on calling super تم الحل
modules dependencies override super
الصورة الرمزية
الصورة الرمزية
1
أكتوبر 23
3307
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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