İç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

How to resolve the error “IndexError: list index out of range”?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
python3odoo11
3 Cevaplar
65879 Görünümler
Avatar
Dhouha

I'm using Odoo 11 and I have installed openHRMS module but every time when I press on the dashboard menu it appears an error on this method:

IndexError: list index out of range

Ps: i tried to install this module on bitnami VM and it works whithout any problem but when i tried to installe it on ubuntu 18.04 it shows error

Any ideas on how to fix it?

 def join_resign_trends(self):
    cr = self._cr
    month_list = []
    join_trend = []
    resign_trend = []
    for i in range(11, -1, -1):
        last_month = datetime.now() - relativedelta(months=i)
        text = format(last_month, '%B %Y')
        month_list.append(text)
    for month in month_list:
        vals = {
            'l_month': month,
            'count': 0
        }
        join_trend.append(vals)
    for month in month_list:
        vals = {
            'l_month': month,
            'count': 0
        }
        resign_trend.append(vals)
    cr.execute('''select to_char(joining_date, 'Month YYYY') as l_month, count(id) from hr_employee 
    WHERE joining_date BETWEEN CURRENT_DATE - INTERVAL '12 months'
    AND CURRENT_DATE + interval '1 month - 1 day'
    group by l_month;''')
    join_data = cr.fetchall()
    cr.execute('''select to_char(resign_date, 'Month YYYY') as l_month, count(id) from hr_employee 
    WHERE resign_date BETWEEN CURRENT_DATE - INTERVAL '12 months'
    AND CURRENT_DATE + interval '1 month - 1 day'
    group by l_month;''')
    resign_data = cr.fetchall()

    for line in join_data:
        match = list(filter(lambda d: d['l_month'].replace(' ', '') == line[0].replace(' ', ''), join_trend))
        match[0]['count'] = line[1]
    for line in resign_data:
        match = list(filter(lambda d: d['l_month'].replace(' ', '') == line[0].replace(' ', ''), resign_trend))
        match[0]['count'] = line[1]
    for join in join_trend:
        join['l_month'] = join['l_month'].split(' ')[:1][0].strip()[:3]
    for resign in resign_trend:
        resign['l_month'] = resign['l_month'].split(' ')[:1][0].strip()[:3]
    graph_result = [{
        'name': 'Join',
        'values': join_trend
    }, {
        'name': 'Resign',
        'values': resign_trend
    }]
    return graph_result

 def get_attrition_rate(self):
    month_attrition = []
    monthly_join_resign = self.join_resign_trends()
    month_join = monthly_join_resign[0]['values']
    month_resign = monthly_join_resign[1]['values']
    sql = """
    SELECT (date_trunc('month', CURRENT_DATE))::date - interval '1' month * s.a AS month_start 
    FROM generate_series(0,11,1) AS s(a);"""
    self._cr.execute(sql)
    month_start_list = self._cr.fetchall()
    for month_date in month_start_list:
        self._cr.execute("""select count(id), to_char(date '%s', 'Month YYYY') as l_month from hr_employee 
        where resign_date> date '%s' or resign_date is null and joining_date < date '%s'
        """ % (month_date[0], month_date[0], month_date[0],))
        month_emp = self._cr.fetchone()
        # month_emp = (month_emp[0], month_emp[1].split(' ')[:1][0].strip()[:3])
        match_join = list(filter(lambda d: d['l_month'] == month_emp[1].split(' ')[:1][0].strip()[:3], month_join))[0]['count']
        match_resign = list(filter(lambda d: d['l_month'] == month_emp[1].split(' ')[:1][0].strip()[:3], month_resign))[0]['count']
        month_avg = (month_emp[0]+match_join-match_resign+month_emp[0])/2
        attrition_rate = (match_resign/month_avg)*100 if month_avg != 0 else 0
        vals = {
            # 'month': month_emp[1].split(' ')[:1][0].strip()[:3] + ' ' + month_emp[1].split(' ')[-1:][0],
            'month': month_emp[1].split(' ')[:1][0].strip()[:3],
            'attrition_rate': round(float(attrition_rate), 2)
        }
        month_attrition.append(vals)
    return month_attrition

traceback

   Traceback (most recent call last):
   File "/opt/openhrms/odoo/http.py", line 651, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/openhrms/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/openhrms/odoo/tools/pycompat.py", line 87, in reraise
raise value
  File "/opt/openhrms/odoo/http.py", line 693, in dispatch
result = self._call_function(**self.params)
  File "/opt/openhrms/odoo/http.py", line 342, in _call_function
return checked_call(self.db, *args, **kwargs)
  File "/opt/openhrms/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
  File "/opt/openhrms/odoo/http.py", line 335, in checked_call
result = self.endpoint(*a, **kw)
  File "/opt/openhrms/odoo/http.py", line 937, in __call__
return self.method(*args, **kw)
  File "/opt/openhrms/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
 File "/opt/openhrms/addons/web/controllers/main.py", line 934, in call_kw
return self._call_kw(model, method, args, kwargs)
 File "/opt/openhrms/addons/web/controllers/main.py", line 926, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
 File "/opt/openhrms/odoo/api.py", line 687, in call_kw
return call_kw_model(method, model, args, kwargs)
 File "/opt/openhrms/odoo/api.py", line 672, in call_kw_model
result = method(recs, *args, **kwargs)
 File "/opt/openhrms/openhrms/hrms_dashboard/models/hrms_dashboard.py", line 384, in get_attrition_rate
monthly_join_resign = self.join_resign_trends()
 File "/opt/openhrms/openhrms/hrms_dashboard/models/hrms_dashboard.py", line 364, in join_resign_trends
match[0]['count'] = line[1]
IndexError: list index out of range
0
Avatar
Vazgeç
Yenthe Van Ginneken (Mainframe Monkey)

line[1] doesn't exist as line[] is empty (or only has [0]) which gives this error.

Dhouha
Üretici

Thanks for your answer i tried to modify line[1] --> line[0] but it shows the same error

Avatar
Bhaviraj Brahmkshatriya
En İyi Yanıt

Hello Dhouda,

Put some print statements. May be it will help. i thing no data is coming into sql query, so it is blank list.

and it is blank list if you do list[0] even though it gives same error. So verify your code.

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 set a filter as default filter in odoo Çözüldü
python3 odoo11
Avatar
Avatar
Avatar
2
Şub 24
16898
How to set default stage to when recruitement record is created Çözüldü
python3 odoo11
Avatar
Avatar
1
Ara 22
5892
How to change the value of a field which depends on other fields automatically ? Çözüldü
python3 odoo11
Avatar
Avatar
Avatar
2
Ara 22
15816
how to modify fields of hr.attendance via a modification request automatically Çözüldü
python3 odoo11
Avatar
Avatar
Avatar
2
Haz 22
7985
how to update field of attendance via an attendance request modification
python3 odoo11
Avatar
Avatar
Avatar
2
Haz 22
5899
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