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

Memory Error When Installing Modules with Computed Stored Fields

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
performancemodulememoryodoocomputed-fieldsstore=True
1 Odpowiedz
2371 Widoki
Awatar
Lenin Acosta

Hello everyone,


I have several custom modules that I need to install, which extend models like sale.order.line and account.move.line. These models contain a large number of records.


In my custom modules, I have fields with compute and store=True, and I suspect this might be causing a memory error during installation. I would like to understand the best approach to successfully install these modules without running into performance or memory issues.


Here’s an example of one of the modules:


class SaleOrderLine(models.Model):

    _inherit = 'sale.order.line'


    currency_id2 = fields.Many2one(related='order_id.currency_id2', depends=['order_id.currency_id2'], store=True,

                                   string='Secondary Currency')

    price_subtotal_rate = fields.Monetary(string='Subtotal', currency_field='currency_id2',

                                          compute='_compute_amount_rate_line', store=True)

    price_unit_rate = fields.Monetary(string='Unit Price', currency_field='currency_id2',

                                      compute='_compute_amount_rate_line', store=True)


    @api.depends('order_id.rate', 'currency_id2', 'price_unit', 'price_subtotal')

    def _compute_amount_rate_line(self):

        _logger.info("Entering the method")

        for line in self:

            if line.order_id.company_id.currency_id2 == line.order_id.currency_id:

                line.update({

                    'price_unit_rate': line.price_unit * line.order_id.rate,

                    'price_subtotal_rate': line.price_subtotal * line.order_id.rate,

                })

            if line.order_id.company_id.currency_id == line.order_id.currency_id:

                if line.order_id.rate:

                    line.update({

                        'price_unit_rate': line.price_unit / line.order_id.rate,

                        'price_subtotal_rate': line.price_subtotal / line.order_id.rate

                    })

        _logger.info("Exiting the method")

I would appreciate any advice on optimizing the installation process, especially regarding computed stored fields that may cause performance issues.


Thank you!


Here is an example of the error:

RPC_ERROR


Odoo Server Error


Traceback (most recent call last):


  File , line 899, in get


    return field_cache[record._ids[0]]


KeyError: 533602




During handling of the above exception, another exception occurred:




Traceback (most recent call last):


  File , line 1083, in _get_


    value = env.cache.get(record, self)


  File , line 902, in get


    raise CacheMiss(record, field)


odoo.exceptions.CacheMiss: 'sale.order.line(533602,).order_id'




The above exception was the direct cause of the following exception:




Traceback (most recent call last):


  File , line 242, in _dispatch


    result = request.dispatch()


  File , line 702, in dispatch


    result = self._call_function(**self.params)


  File , line 368, in _call_function


    return checked_call(self.db, *args, **kwargs)


  File , line 94, in wrapper


    return f(dbname, *args, **kwargs)


  File , line 357, in checked_call


    result = self.endpoint(*a, **kw)


  File , line 925, in _call_


    return self.method(*args, **kw)


  File , line 546, in response_wrap


    response = f(*args, **kw)


  File , line 1328, in call_button


    action = self._call_kw(model, method, args, kwargs)


  File , line 1316, in _call_kw


    return call_kw(request.env[model], method, args, kwargs)


  File , line 471, in call_kw


    result = _call_kw_multi(method, model, args, kwargs)


  File , line 456, in _call_kw_multi


    result = method(recs, *args, **kwargs)


  File , line 2, in button_immediate_install


  File , line 72, in check_and_log


    return method(self, *args, **kwargs)


  File , line 470, in button_immediate_install


    return self._button_immediate_function(self.env.registry[self._name].button_install)


  File , line 587, in _button_immediate_function


    registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)


  File , line 87, in new


    odoo.modules.load_modules(registry, force_demo, status, update_module)


  File , line 474, in load_modules


    processed_modules += load_marked_modules(cr, graph,


  File , line 363, in load_marked_modules


    loaded, processed = load_module_graph(


  File , line 199, in load_module_graph


    registry.init_models(cr, model_names, {'module': package.name}, new_install)


  File , line 445, in init_models


    env['base'].flush()


  File , line 5692, in flush


    self.recompute()


  File , line 6165, in recompute


    process(field)


  File , line 6149, in process


    field.recompute(recs)


  File , line 1273, in recompute


    self.compute_value(recs)


  File , line 1295, in compute_value


    records._compute_field_value(self)


  File , line 4277, in _compute_field_value


    fields.determine(field.compute, self)


  File , line 88, in determine


    return needle(*args)


  File , line 79, in _compute_amount_rate_line


    if line.order_id.company_id.currency_id2 == line.order_id.currency_id:


  File , line 2620, in _get_


    return super()._get_(records, owner)


  File , line 1109, in _get_


    recs._fetch_field(self)


  File , line 3277, in _fetch_field


    fnames = [


  File , line 3285, in <listcomp>


    if not (f.compute and self.env.records_to_compute(f))


  File , line 756, in records_to_compute


    return self[field.model_name].browse(ids)


  File , line 5211, in browse


    ids = tuple(ids)


Exception




The above exception was the direct cause of the following exception:




Traceback (most recent call last):


  File , line 658, in _handle_exception


    return super(JsonRequest, self)._handle_exception(exception)


  File , line 301, in _handle_exception


    raise exception.with_traceback(None) from new_cause


MemoryError


0
Awatar
Odrzuć
Awatar
Niyas Raphy (Walnut Software Solutions)
Najlepsza odpowiedź

Hi,
You can speed up the installation by adding the new fields forcefully into the database and later using some scripts you can compute the values into the field.

Sample;
    def _auto_init(self):

        """

        Create related field here, too slow

        when computing it afterwards through _compute_related.


        Since group_id.sale_id is created in this module,

        no need for an UPDATE statement.

        """

        if not column_exists(self.env.cr, 'stock_picking', 'sale_id'):

            create_column(self.env.cr, 'stock_picking', 'sale_id', 'int4')

        return super()._auto_init()

Thanks

0
Awatar
Odrzuć
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ść
[13.0] Module installation failed due to stored compute field on large database
performance installation memory computed-fields 13.0
Awatar
Awatar
1
wrz 21
6661
How can we Uninstall odoo module from terminal? Rozwiązane
module odoo
Awatar
Awatar
Awatar
Awatar
3
wrz 25
21937
Odoo - Find module to show group by parent/child value in tree view
module python3 odoo
Awatar
0
kwi 23
3796
Model Name in Fleet module? Rozwiązane
fleet module computed-fields
Awatar
Awatar
2
lut 22
5298
cache in odoo ?
performance cache odoo
Awatar
0
cze 21
5843
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