Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Kov
    • Nábytek
    • Jídlo
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • IT hardware a podpora
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How to properly import odoo in VisualStudio Code

Odebírat

Get notified when there's activity on this post

This question has been flagged
configurationimportwarningodoo11
9 Odpovědi
27254 Zobrazení
Avatar
Sebastian


First of i want to say that this issue is not breaking my installation its just hindering in my workflow.

When i import the odoo module like so: "from odoo import api, models, fields" i get the follwing warning:

'unresolved import 'odoo'Python(unresolved-import)' and there is a wavy line  underneath the word odoo.

Also because VSCode doesnt recognize odoo everytime the work fields is written i get a warning: 'Undefined variable:' fields'

As i said before i can compile and everything runs like expected but i see alot of warning i cant get rid of.

I googled the issue but couldnt find anything that fixed the problem.

I am probably missing something in my config files somewhere. 

Thanks for your help in advance.

Best wishes,

 Sebastian


2
Avatar
Zrušit
Avatar
Hayagreeva Aditya Kasibhotla
Nejlepší odpověď

To properly import odoo without a sweat, there's a simple tutorial: 


1
Avatar
Zrušit
Avatar
ANGEL ADAN RAMIREZ ISEA
Nejlepší odpověď

File -> Preferences -> Settings -> type import -> Choose Python on the left

Click on "Edit in settings.json":

"python.analysis.extraPaths": ["/your/path/to/odoo-16.0/" ]

Restart VS Code and enjoy.

4
Avatar
Zrušit
Avatar
Michael
Nejlepší odpověď

Following process worked for me:

Open Workspace Settings:

  • In the Command Palette, search for Preferences: Open Workspace Settings (JSON), or select the workspace tab if you see it in the settings menu.

Add python.analysis.extraPaths in Workspace settings.json:

  • Add the following line with the path to your Odoo source:
    jsonCopy code"python.analysis.extraPaths": [
        "/your/path/to/odoo-16.0/"
    ]
    
  • Replace "/your/path/to/odoo-16.0/" with the actual path to your Odoo source folder.

Save and Restart:

  • Save your changes in the settings.json file and restart VS Code to apply the settings.
0
Avatar
Zrušit
Avatar
Rome Maristany
Nejlepší odpověď

Hi, I know your question was a long time ago but I'm new to odoo and I have this same problem. Finally, how did you solve it? I tried the solutions they gave you but it didn't work.

0
Avatar
Zrušit
Avatar
osvaldo farfan
Nejlepší odpověď

Hello, I find myself having the same problem, did you manage to solve it????

I have spent several days looking for a way to solve the problem but still can't find it... 

0
Avatar
Zrušit
Avatar
IB Teguh TM
Nejlepší odpověď

Do you have how to solve this problem ?

i have temporary problem to solve it
1. add the folder script in setting.json and add python.analysis.extraPaths setting for the workspace.
'Import "Path.to.own.script" could not be resolved Pylance (reportMissingImports)' in VS Code using Python 3.x on Ubuntu 20.04 LTS. but this is not work for me
2. below the SO answer, there are (1) 
In VS code you can edit the setting.json file. If you add "python.analysis.useImportHeuristic": true the linting error will be removed. i think this is dangerous because make you not cant see problem
3. (2) The alternative is to add # type: ignore at the end of the import code. i like this answer after compile and there are no error, i can put #type : ignore and problem is gone

0
Avatar
Zrušit
Avatar
Shringar Gupta
Nejlepší odpověď

That wavy line you are seeing because you may be opening a folder which contains odoo. Try opening only odoo named folder that you have downloaded at the time of installation. Your issue will be solved.

It troubled me as well when i initially started using odoo.

0
Avatar
Zrušit
Raymond Ho

On the contrary, the squiggly line appears because the odoo folder is not included, so the vscode app opens the directory at the next level. For example, your vscode works in the odoo-dev/my_library folder, and the odoo module from odoo import models, fields will have wavy lines. To solve it simply, vscode can open the directory odoo-dev at the next level as the working directory. Tip: There's odoo-dev/odoo inside

Avatar
Sebastian
Autor Nejlepší odpověď

Sorry our company only uses VSCode so PyCharm is not an option for us. Thank you anyways

0
Avatar
Zrušit
Avatar
Fernando La Chica Mera
Nejlepší odpověď

Have you tried PyCharm? This editor has many advantages over VSCode as is its search for code based on regex. It does not answer your question but the alternative is worth trying.

0
Avatar
Zrušit
André Canilho

VS Code does everything you can do with Pycharm and more, Regex search is possible.
The only issue I've seen, which is more of a Windows + VsCode issue, is that it doesn't always end the process on rebuild.

PS: I've used PyCharm for 3 Years, and VS Code since it was released for multiple languages and stacks.

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

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Show warning in a wizard
wizard warning odoo11
Avatar
Avatar
1
srp 25
8219
Import data for accounting module
configuration import counting
Avatar
Avatar
Avatar
2
kvě 24
3093
Odoo 11 - MemoryError - RuntimeError: can't start new thread - The Connection Pool Is Full
configuration server500 odoo11
Avatar
0
říj 20
7030
Odoo losing connection when few people working at the same time
configuration performance odoo11
Avatar
Avatar
6
zář 20
5660
I can't import data to odoo from an excel table Vyřešeno
import employee odoo11
Avatar
Avatar
2
lis 19
7990
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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