Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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

Problems when using "import tools" instead of "import openerp.tools"

Suscribirse

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

Se marcó esta pregunta
developmentpythonlibrary
1 Responder
27282 Vistas
Avatar
Andreas Brueckl

Hello,

I often see modules which are using

import tools

instead of

import openerp.tools

My installation cannot resolve a library without the preceeding "openerp.". I think that this depends on the type of installation and it would not be a problem if a deb-Package is installed.

So my question:

What can I do, than modules without the preceeding "openerp." are working for my installation?

Here is the log of the installation of a module:

File "/opt/openerp/openerp-7.0-bzr/server/openerp/modules/module.py", line 346, in load_openerp_module __import__('openerp.addons.' + module_name) File "/opt/openerp/openerp-7.0-bzr/server/openerp/modules/module.py", line 82, in load_module mod = imp.load_module('openerp.addons.' + module_part, f, path, descr) File "/opt/openerp/addons-elbati/hr_attendance_analysis/__init__.py", line 22, in <module> import hr_attendance File "/opt/openerp/addons-elbati/hr_attendance_analysis/hr_attendance.py", line 24, in <module> from tools.translate import _ ImportError: No module named tools.translate

0
Avatar
Descartar
Cyril Gaspard (GEM)

Hi, for location of your module, did you use same unix user account, same partition disk, it is placed in server/openerp/addons directory, did you use symlink, addons_path option in opeenrp server conf file ? Personnaly by using addons_path option in server conf file I have not this error. Bye

Andreas Brueckl
Autor

Thanks for your comment. I try to install module "hr_attendance_analysis" of branch "lp:~elbati/hr-timesheet/adding_hr_attendance_analysis_7". all unix permissions are ok. I tried with addons_path, symlink and direct copy into /server/openerp/addons path without success. I am starting the server in the server directory with ./openerp-server -c /etc/openerp-server-7.conf

Cyril Gaspard (GEM)

Hi, with openerp 7 it seems it is now openerp.tools ... which is used. But try to add ..../server/openerp path to pythonpath (search on google how to deine multi path for pythonpath). Should works (I believe deb package installs openerp in python site-packages directory, in this case no problme to find libraries python). Bye

Avatar
Andreas Brueckl
Autor Mejor respuesta

Thanks to GEM I have solved this issue by dynamically adding the openerp directory to the python path. I have added two lines to file server/openerp-server:

#!/usr/bin/env python
import openerp

# Start ADD
import sys
sys.path.append('openerp')
# End ADD

if __name__ == "__main__":
    openerp.cli.main()

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

However it is strange that I am the only guy who runs openerp without the deb package and focused this issue.

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

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
TypeError str and datetime Resuelto
development python
Avatar
Avatar
Avatar
2
ago 24
2320
Python library not installed: webp Resuelto
python library
Avatar
Avatar
2
ago 20
6931
Duplicate Orders in POS When Clicking Order Button (Odoo 18)
development python Point Of Sale
Avatar
Avatar
2
feb 25
2441
Issue with a new Product Label Template (102x102) in Odoo V17
development python qweb
Avatar
0
dic 24
1798
Best practices for code reuse in Odoo addon development ?
development python methodology
Avatar
Avatar
1
abr 23
6109
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar 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