Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

how debug code from visual studio code in docker container?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
remotedebuggingodooDockervscode
6 Răspunsuri
37335 Vizualizări
Imagine profil
Mark Okolov

i want set red point on any line and see debug mod

0
Imagine profil
Abandonează
Imagine profil
Ivan Sokolov
Cel mai bun răspuns

You can use the following manual to configure VSCode for debugging Odoo using Docker:

https://cetmix.com/blog/cetmix-blog-2/odoo-development-using-visual-studio-code-and-docker-1

3
Imagine profil
Abandonează
Imagine profil
Edgar Guadalupe de la Cruz Vasconcelos
Cel mai bun răspuns

Hello friends, try the configuration that was marked as an answer but I get "Failler to attach (connect ECONNREFUSED 172.18.0.3:3000)" inside the container according to point 3 but with the ip of the container and copy the json to my debug file and can anything help me ??

0
Imagine profil
Abandonează
Mark Okolov
Autor

Hi Edgar, did you run first container and after attached debugger? if no try this, if yes give me your launch.json and docker inspect result

Edgar Guadalupe de la Cruz Vasconcelos

{

"version": "0.2.0",

"configurations": [

{

"name": "Odoo: Attach",

"type": "python",

"request": "attach",

"port": 8069,

"debugServer": 8888,

"host": "localhost",

"pathMappings": [

{

"localRoot": "${workspaceFolder}/addons",

"remoteRoot": "/mnt/extra-addons", //path to custom addons inside docker

}

],

"logToFile": true

}

]

}

Imagine profil
Ravi Gadhia
Cel mai bun răspuns


set the following configurations in launch.json (Menu: Debug > Add Configuration.. ) of visual studio code
start odoo from Debug >Strat Debugging 

"configurations": [{
   "name": "Python: Odoo",
   "type": "python",
   "request": "launch",
   "program": "${workspaceFolder}/workspace/odoo-bin",
   "args": ["start", "--database=12.0", "--db-filter=12.0", "--addons-path=workspace/addons,enterprise"],
},
]​
​Note: change path according to your working directory.

I don't know how to set up it for a docker container.

0
Imagine profil
Abandonează
Imagine profil
Mark Okolov
Autor Cel mai bun răspuns

steps:

1) find odoo-bin file and add new lines:

import subprocess
import time
process = subprocess.Popen("hostname -I | awk '{print $BASH_ARGV}'", stdout=subprocess.PIPE, shell=True)
while process.wait():
    time.sleep(0.1)
output, err = process.communicate()
host = output.split()[-1].decode("utf-8") 
print(host)
try:
    import ptvsd
except ImportError:
    subprocess.call('pip install ptvsd --user', shell=True)
    import ptvsd
ptvsd.enable_attach(address = (host, 3000))

where host var is IP address remote, you can find it in output terminal or run next command:

docker inspect odoo_container

in my case it was 172.25.0.4

2) create new dict in launch.json:

{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"port": 3000,
    "host": "host var value", // 172.25.0.4
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
 ]
}

3) it is all. now you can add in any place of your code "breakpoint()" and activate debug mode

and when this part of code will be called debugger will work in vscode





0
Imagine profil
Abandonează
Mark Okolov
Autor

if you using git for original odoo you can use "git update-index --assume-unchanged odoo-bin" that git dont triggering on this file

Imagine profil
Khaled
Cel mai bun răspuns

Well, I guess there is better way that there is no need to add code to odoo itself

https://gist.github.com/kerbrose/e646aaf9daece42b46091e2ca0eb55d0

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Odoo: Attach",
            "type": "python",
            "request": "attach",
            "port": 8879,
            "debugServer": 8888,
            "host": "localhost",
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "/mnt/extra-addons", //path to custom addons inside docker
                },
                {
                    "localRoot": "/dev/odoo", //odoo source code
                    "remoteRoot": "/odoo",    //path to source inside docker
                }
            ],
            "logToFile": true
            //"preLaunchTask": "init docker",
            //"postDebugTask": "stop docker"
        }
    ]
}

please note that your docker.dev file should include

RUN pip3 install -U debugpy

then you will be running the debugger not odoo as
docker run --rm -p 8888:3001 -p 8879:8069 odoo /usr/bin/python3 -m debugpy --listen 0.0.0.0:3001 /usr/bin/odoo --db_user=odoo --db_host=db --db_password=odoo
or
docker-compose run --rm -p 8888:3001 -p 8879:8069 odoo /usr/bin/python3 -m debugpy --listen 0.0.0.0:3001 /usr/bin/odoo --db_user=odoo --db_host=db --db_password=odoo
0
Imagine profil
Abandonează
Imagine profil
Nanda Kumar Mangati
Cel mai bun răspuns

https://dev.to/kerbrose/how-to-remote-debugging-odoo-docker-images-python-based-framework-4o2h has a more up to date answer.

-1
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
How to Debug odoo python via PyCharms Rezolvat
debug remote debugging odoo Pycharm4
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
dec. 19
12092
How to run without debug mode by ide vscode
odoo vscode
Imagine profil
0
nov. 23
1974
How to make shop acessible on for registered users Rezolvat
odoo Docker
Imagine profil
Imagine profil
2
sept. 23
2283
Odoo on Docker multiple proyects in one server
odoo Docker
Imagine profil
0
sept. 21
4625
ERROR: for odoo-13-docker-compose_odoo13_1 a bytes-like object is required, not 'str' in docker-compose up
odoo Docker
Imagine profil
0
feb. 21
5724
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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