Skip to Content
Odoo मेन्यू
  • Sign in
  • मुफ़्त में आज़माएं
  • ऐप्लिकेशन
    फ़ाइनेंस
    • अकाउंटिंग
    • इनवॉइसिंग
    • एक्सपेंस
    • स्प्रेडशीट (बीआई)
    • डॉक्यूमेंट्स
    • साइन
    सेल्स
    • सीआरएम
    • सेल्स
    • पीओएस शॉप
    • पीओएस रेस्टोरेंट
    • सब्सक्रिप्शन
    • रेंटल
    वेबसाइट
    • वेबसाइट बिल्डर
    • ई-कॉमर्स
    • ब्लॉग
    • फ़ोरम
    • लाइव चैट
    • ई-लर्निंग
    सप्लाई चेन
    • इन्वेंट्री
    • मैन्युफ़ैक्चरिंग
    • पीएलएम
    • परचेज़
    • मेंटेनेंस
    • क्वालिटी
    मानव संसाधन
    • कर्मचारी
    • रिक्रूटमेंट
    • टाइम ऑफ़
    • अप्रेज़ल
    • रेफ़रल
    • फ़्लीट
    मार्केटिंग
    • सोशल मार्केटिंग
    • ईमेल मार्केटिंग
    • एसएमएस मार्केटिंग
    • इवेंट
    • मार्केटिंग ऑटोमेशन
    • सर्वे
    सेवाएं
    • प्रोजेक्ट
    • टाइमशीट
    • फ़ील्ड सर्विस
    • हेल्पडेस्क
    • प्लानिंग
    • अपॉइंटमेंट
    प्रॉडक्टिविटी
    • डिस्कस
    • अप्रूवल
    • आईओटी
    • वीओआईपी
    • नॉलेज
    • WhatsApp
    तीसरे पक्ष के ऐप्लिकेशन Odoo स्टूडियो Odoo क्लाउड प्लेटफ़ॉर्म
  • इंडस्ट्री
    रीटेल
    • बुक स्टोर
    • क्लोदिंग स्टोर
    • फ़र्नीचर स्टोर
    • ग्रॉसरी स्टोर
    • हार्डवेयर स्टोर
    • टॉय स्टोर
    Food & Hospitality
    • बार और पब
    • रेस्टोरेंट
    • फ़ास्ट फ़ूड
    • Guest House
    • बेवरिज डिस्ट्रीब्यूटर
    • Hotel
    Real Estate
    • Real Estate Agency
    • आर्किटेक्चर फ़र्म
    • कंसट्रक्शन
    • एस्टेट मैनेजमेंट
    • गार्ड्निंग
    • प्रॉपर्टी ओनर असोसिएशन
    Consulting
    • Accounting Firm
    • Odoo पार्टनर
    • Marketing Agency
    • लॉ फ़र्म
    • टैलेंट ऐक्विज़िशन
    • ऑडिट & सर्टिफ़िकेशन
    मैन्युफ़ैक्चरिंग
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • कॉर्पोरेट गिफ़्ट
    हेल्थ & फिटनेस
    • स्पोर्ट्स क्लब
    • आईवियर स्टोर
    • फिटनेस सेंटर
    • वेलनेस प्रैक्टिशनर
    • फॉर्मेसी
    • हेयर सैलून
    Trades
    • Handyman
    • आईटी हॉर्डवेयर और सपोर्ट
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • एन्वायरमेंटल एजेंसी
    • बिलबोर्ड रेंटल
    • फ़ोटोग्राफी
    • बाइक लीजिंग
    • सॉफ़्टवेयर रीसेलर
    Browse all Industries
  • कम्यूनिटी
    सीखें
    • ट्यूटोरियल्स
    • दस्तावेज़
    • सर्टिफ़िकेशन
    • ट्रेनिंग
    • ब्लॉग
    • पॉडकास्ट
    शिक्षा को बढ़ावा दें
    • एजुकेशन प्रोग्राम
    • स्केल अप! बिजनेस गेम
    • Odoo के ऑफ़िस में आएं
    सॉफ़्टवेयर पाएं
    • डाउनलोड
    • वर्शन की तुलना करें
    • रिलीज़
    साथ मिलकर काम करें
    • Github
    • फ़ोरम
    • इवेंट
    • अनुवाद
    • पार्टनर बनें
    • Services for Partners
    • अपना अकाउंटिंग फ़र्म रजिस्टर करें
    सेवाएं पाएं
    • पार्टनर ढूंढें
    • अकाउंटेंट खोजें
    • सलाहकार की मदद लें
    • इम्प्लिमेंटेशन सेवाएं
    • कस्टमर रेफ़रेंस
    • सहायता
    • अपग्रेड
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    डेमो देखें
  • कीमत
  • सहायता

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

  • सीआरएम
  • e-Commerce
  • लेखांकन
  • इन्वेंटरी
  • PoS
  • प्रोजेक्ट
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
टैग (View all)
odoo accounting v14 pos v15
About this forum
Help

AttributeError: 'int' object has no attribute 'get'

Subscribe

Get notified when there's activity on this post

This question has been flagged
makoopenerp7
3 Replies
13577 Views
Avatar
Rihene

Good Morning everybody;

In fact, i am creating a new report in OpenERP.

So, i call a function in the file.py of the report:

def get_details(self, year, context=None):

res_list=[]

if not context:

context = None

ret = []

obj = self.pool.get('hr.employee')

obj_ids = obj.search(self.cr, self.uid, [('name_related','!=', '')])

print ('testing me')

 ####################"the error is in this line##################

res = obj.read(self.cr, self.uid, obj_ids, ['id', 'name_related','momo_matricule','birthday'], context)

date_jour = time.strftime('%y/%m/%d',time.localtime())

date_jour_annee = time.strftime('%Y',time.localtime())

for r in res :

objs = {}

birthday = r['birthday']

objs['nom_employe'] = r['name_related']

a = int(birthday[:4])

b = date_jour_annee

age = int(b) - int(a)

obj3 = self.pool.get('hr.holidays')

key = r['id']

obj_ids3 = obj3.search(self.cr, self.uid, [('employee_id','=',key),('state','=','validate')])

res3 = obj3.read(self.cr, self.uid, obj_ids3, ['number_of_days', 'date_from','resumption_date','employee_id'], context)

# print res3

if age < 35:

k = []

for var in res3:

k.append(var['number_of_days'])

playlist = {}

playlist["employee_id"] = var['employee_id']

playlist["holidays"] = []

playlist["holidays"].append(var['number_of_days'])

print('***************************************************************')

print playlist

row_json = json.dumps(k)

print row_json

objs['number_days'] = k

else:

for var in res3:

objs['number_days_jeune'] = var['number_of_days']

objs['date_from_jeune'] = var['date_from']

objs['resumption_date_jeune'] = var['resumption_date']

obj2 = self.pool.get('hr.contract')

obj_ids2 = obj2.search(self.cr, self.uid, [('employee_id','=',key)])

res2 = obj2.read(self.cr, self.uid, obj_ids2, ['id', 'date_start','trial_date_start'], context)

for t in res2 :

if t['trial_date_start'] == False:

objs['date_to'] = t['date_start']

else:

objs['date_to'] = t['trial_date_start']

objs['date_to'] = t['date_start']

objs['year'] = year

res_list.append(objs)

return res_list

when i click on PRINT, i got this error:

2015-11-16 10:24:15,688 5820 ERROR openerp openerp.addons.report_webkit.webkit_report:

Traceback (most recent call last):

File "/opt/openerp/v7/addons/report_webkit/webkit_report.py", line 274, in create_single_pdf

**self.parser_instance.localcontext)

File "/usr/lib/python2.7/dist-packages/mako/template.py", line 443, in render

return runtime._render(self, self.callable_, args, data)

File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 803, in _render

**_kwargs_for_callable(callable_, data))

File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 835, in _render_context

_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)

File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 860, in _exec_template

callable_(context, *args, **kwargs)

File "memory:0x7fb7d6412650", line 111, in render_body

%for item in get_details(cr,uid):

File "/opt/openerp/v7/addons/seetek_payroll/report/report_leaves.py", line 62, in get_details

test = obj.read(self.cr, self.uid, obj_ids, ['id', 'name_related','momo_matricule','birthday'], context)

File "/opt/openerp/v7/server/openerp/osv/orm.py", line 3679, in read

result = self._read_flat(cr, user, select, fields, context, load)

File "/opt/openerp/v7/server/openerp/osv/orm.py", line 3740, in _read_flat

if context.get('lang'):

AttributeError: 'int' object has no attribute 'get'

Is here any suggestion to help.

Thanks a lot in advance.

Regards.

1
Avatar
Discard
Avatar
Rihene
Author Best Answer

Hello!!!!

I have found the answer to my question.

Here is the answer:

res = obj.read(self.cr, self.uid, obj_ids, ['id', 'name_related','momo_matricule','birthday'], context)

I have to delete the context as a parameter to read.

res = obj.read(self.cr, self.uid, obj_ids, ['id', 'name_related','momo_matricule','birthday'])

Best Regards.

1
Avatar
Discard
Avatar
Bipin rathod
Best Answer

Hello,


obj_ids = obj.search(self.cr, self.uid, [('name_related','!=', '')])

problem here, when you search you will not get any obj_ids here, please use proper domain and use it again.


Hope after changing the domain, it will be work.

1
Avatar
Discard
Rihene
Author

friend, i have changed that but nothing happened :/

Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
How to add footer in mako report?
mako openerp7
Avatar
Avatar
1
दिस॰ 15
5122
object is not callable in mako for OpenERP
mako openerp7
Avatar
0
नव॰ 15
4253
How to call a python function in a mako file
python mako openerp7
Avatar
Avatar
1
नव॰ 15
7081
Error: NameError: name 'field' is not defined
openerp7
Avatar
Avatar
Avatar
2
मई 22
35068
How to add "meta viewport" tag in OpenERP v7.0?
openerp7
Avatar
0
मार्च 19
4907
कम्यूनिटी
  • ट्यूटोरियल्स
  • दस्तावेज़
  • फ़ोरम
ओपन सोर्स
  • डाउनलोड
  • Github
  • रनबॉट
  • अनुवाद
सेवाएं
  • Odoo.sh Hosting
  • सहायता
  • अपग्रेड
  • कस्टम डेवलपमेंट्स
  • शिक्षा
  • अकाउंटेंट खोजें
  • पार्टनर ढूंढें
  • पार्टनर बनें
हमारे बारे में
  • हमारी कंपनी
  • ब्रांड ऐसेट
  • संपर्क करें
  • नौकरियां
  • इवेंट
  • पॉडकास्ट
  • ब्लॉग
  • ग्राहक
  • लीगल • गोपनीयता
  • सुरक्षा
الْعَرَبيّة 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, बिज़नेस से जुड़े ऐप्लिकेशन का एक कलेक्शन है जो ओपन सोर्स पर आधारित है. इसमें आपकी कंपनी की हर ज़रूरत के लिए ऐप्लिकेशन हैं. जैसे, सीआरएम, ई-कॉमर्स, अकाउंटिंग, इन्वेंट्री, पॉइंट ऑफ़ सेल, प्रोजेक्ट मैनेजमेंट वगैरह.

Odoo की सबसे बड़ी खासियत है कि यह इस्तेमाल करने में बहुत आसान है और यह पूरी तरह से इंटिग्रेट किया हुआ है.

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