Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

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

Naroči se

Get notified when there's activity on this post

This question has been flagged
developmentpythonlibrary
1 Odgovori
27290 Prikazi
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
Opusti
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
Avtor

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
Avtor Best Answer

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
Opusti
Enjoying the discussion? Don't just read, join in!

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
TypeError str and datetime Solved
development python
Avatar
Avatar
Avatar
2
avg. 24
2323
Python library not installed: webp Solved
python library
Avatar
Avatar
2
avg. 20
6946
Duplicate Orders in POS When Clicking Order Button (Odoo 18)
development python Point Of Sale
Avatar
Avatar
2
feb. 25
2443
Issue with a new Product Label Template (102x102) in Odoo V17
development python qweb
Avatar
0
dec. 24
1799
Best practices for code reuse in Odoo addon development ?
development python methodology
Avatar
Avatar
1
apr. 23
6111
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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