Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
makoopenerp7
3 Respuestas
13601 Vistas
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
Descartar
Avatar
Rihene
Autor Mejor respuesta

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
Descartar
Avatar
Bipin rathod
Mejor respuesta

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
Descartar
Rihene
Autor

friend, i have changed that but nothing happened :/

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
How to add footer in mako report?
mako openerp7
Avatar
Avatar
1
dic 15
5141
object is not callable in mako for OpenERP
mako openerp7
Avatar
0
nov 15
4277
How to call a python function in a mako file
python mako openerp7
Avatar
Avatar
1
nov 15
7110
Error: NameError: name 'field' is not defined
openerp7
Avatar
Avatar
Avatar
2
may 22
35098
How to add "meta viewport" tag in OpenERP v7.0?
openerp7
Avatar
0
mar 19
4939
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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