Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Modules - Order of dependencies

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
modulesdependencies
1 Odpowiedz
11690 Widoki
Awatar
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
Awatar
Odrzuć
Alf Olsen
Autor

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

Awatar
Richard
Najlepsza odpowiedź

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
Awatar
Odrzuć
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.

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
How to have many2one/one2many relation between models from two different modules
modules dependencies v15
Awatar
Awatar
1
lip 22
5631
Nuevo menú en "CRM"
modules
Awatar
Awatar
Awatar
Awatar
3
lip 25
2754
Allow Access to update module
modules
Awatar
Awatar
Awatar
Awatar
3
maj 25
4619
Mozaik dependencies
dependencies
Awatar
Awatar
2
lip 24
2043
Dependency priorities on calling super Rozwiązane
modules dependencies override super
Awatar
Awatar
1
paź 23
3349
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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