Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Odoo payroll multiprocessing to speed it up

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
payrollmultiprocessodoo
1 Antworten
5626 Ansichten
Avatar
AteneoLab

Hi every one, I need to execute a payroll for more than 6K employees. This takes about 4 hours to complete.

I want to parallelize the method that compute and confirms the payroll but it throws this error message:

Traceback (most recent call last):

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/http.py", line 654, in _handle_exception

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

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/http.py", line 312, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/tools/pycompat.py", line 87, in reraise

    raise value

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/http.py", line 696, in dispatch

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

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/http.py", line 344, in _call_function

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

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/service/model.py", line 97, in wrapper

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

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/http.py", line 337, in checked_call

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

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/http.py", line 939, in __call__

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

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/http.py", line 517, in response_wrap

    response = f(*args, **kw)

  File "/home/matos/PycharmProjects/Odoo12/odoo/addons/web/controllers/main.py", line 966, in call_button

    action = self._call_kw(model, method, args, {})

  File "/home/matos/PycharmProjects/Odoo12/odoo/addons/web/controllers/main.py", line 954, in _call_kw

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

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/api.py", line 749, in call_kw

    return _call_kw_multi(method, model, args, kwargs)

  File "/home/matos/PycharmProjects/Odoo12/odoo/odoo/api.py", line 736, in _call_kw_multi

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

  File "/home/matos/PycharmProjects/Odoo12/payroll/payroll_masive/models/payslip_run.py", line 70, in compute_and_confirm_sheet_massive

    pool.map(self.excec, [slip for slip in slip_list_par])

  File "/usr/lib/python3.6/multiprocessing/pool.py", line 288, in map

    return self._map_async(func, iterable, mapstar, chunksize).get()

  File "/usr/lib/python3.6/multiprocessing/pool.py", line 670, in get

    raise self._value

  File "/usr/lib/python3.6/multiprocessing/pool.py", line 450, in _handle_tasks

    put(task)

  File "/usr/lib/python3.6/multiprocessing/connection.py", line 206, in send

    self._send_bytes(_ForkingPickler.dumps(obj))

  File "/usr/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps

    cls(buf, protocol).dump(obj)

_pickle.PicklingError: Can't pickle <class 'odoo.api.hr.payslip.run'>: attribute lookup hr.payslip.run on odoo.api failed

Does anyone of you have any idea of why is this and how to solve it?

Thank you very much.


0
Avatar
Verwerfen
Avatar
djking7
Beste Antwort

you can't  pickle odoo methods, you need to send table of ids to the function declared outside of the class;

Example:

def multi_compute(ids)
kwargs = {'uid': request.uid, 'db': request.db}
with openerp.api.Environment.manage():
with openerp.registry(kwargs.get('db')).cursor() as new_cr:
env = openerp.api.Environment(new_cr, kwargs.get('uid'), {}) 
      playslip_obj = env['hr.payslip']
      payslip_ids = payslip_obj.browse(ids).compute_sheet()       

the call of the method with multiprocessing library should be like this:
list = list(split([slip for slip in slip_list_par], multiprocessing.cpu_count()))

try:
pool = multiprocessing.Pool(multiprocessing.cpu_count())
pool.map(multi_compute, list)
except KeyboardInterrupt, e:
pool.terminate()
raise e

if you get any connection problem add try and except to 'multi_compute' function 
and in the exception recall the method again ('multi_compute(ids)') cause sometimes it's blocked by postgress 
cause another process is blocking you process, so you need to recall it after a time

I hope this helps
                                                                                                                 
0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
How to implement a salary rule for an employee with "Agency Contract"?
payroll odoo
Avatar
0
März 17
4922
I can't register payment when doing payroll as I did not add a bank account
payroll odoo v17
Avatar
1
Feb. 24
96
Wrong python condition defined for salary rule Gelöst
python payroll odoo
Avatar
Avatar
Avatar
2
Dez. 22
8975
Cannot update missing record Gelöst
error payroll odoo
Avatar
Avatar
1
Apr. 21
6261
Odoo set default currency for payroll Gelöst
payroll currency odoo
Avatar
Avatar
1
Jan. 20
5164
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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