İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Odoo payroll multiprocessing to speed it up

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
payrollmultiprocessodoo
1 Cevapla
5615 Görünümler
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
Vazgeç
Avatar
djking7
En İyi Yanıt

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
Vazgeç
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
How to implement a salary rule for an employee with "Agency Contract"?
payroll odoo
Avatar
0
Mar 17
4904
I can't register payment when doing payroll as I did not add a bank account
payroll odoo v17
Avatar
1
Şub 24
96
Wrong python condition defined for salary rule Çözüldü
python payroll odoo
Avatar
Avatar
Avatar
2
Ara 22
8966
Cannot update missing record Çözüldü
error payroll odoo
Avatar
Avatar
1
Nis 21
6252
Odoo set default currency for payroll Çözüldü
payroll currency odoo
Avatar
Avatar
1
Oca 20
5157
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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