Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Odoo payroll multiprocessing to speed it up

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
payrollmultiprocessodoo
1 Beantwoorden
5605 Weergaven
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
Annuleer
Avatar
djking7
Beste antwoord

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
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
How to implement a salary rule for an employee with "Agency Contract"?
payroll odoo
Avatar
0
mrt. 17
4900
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 Opgelost
python payroll odoo
Avatar
Avatar
Avatar
2
dec. 22
8965
Cannot update missing record Opgelost
error payroll odoo
Avatar
Avatar
1
apr. 21
6240
Odoo set default currency for payroll Opgelost
payroll currency odoo
Avatar
Avatar
1
jan. 20
5151
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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