Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

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

Odoberať

Get notified when there's activity on this post

This question has been flagged
makoopenerp7
3 Replies
13611 Zobrazenia
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
Zrušiť
Avatar
Rihene
Autor 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
Zrušiť
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
Zrušiť
Rihene
Autor

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!

Registrácia
Related Posts Replies Zobrazenia Aktivita
How to add footer in mako report?
mako openerp7
Avatar
Avatar
1
dec 15
5156
object is not callable in mako for OpenERP
mako openerp7
Avatar
0
nov 15
4288
How to call a python function in a mako file
python mako openerp7
Avatar
Avatar
1
nov 15
7131
Error: NameError: name 'field' is not defined
openerp7
Avatar
Avatar
Avatar
2
máj 22
35114
How to add "meta viewport" tag in OpenERP v7.0?
openerp7
Avatar
0
mar 19
4946
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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