diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..ac73205 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,15 @@ +{ + "name": "Open Workshop (Odoo Dev)", + "dockerComposeFile": ["${localWorkspaceFolder}/../../odoo/docker-compose.dev.yaml"], + "service": "odoo-dev", + "workspaceFolder": "/mnt/extra-addons/open_workshop", + "runServices": ["odoo-dev", "db"], + "shutdownAction": "stopCompose", + "remoteUser": "root", + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance" + ], + "forwardPorts": [4338], + "postStartCommand": "echo 'Devcontainer started'" +} diff --git a/.vscode/README.md b/.vscode/README.md new file mode 100644 index 0000000..ba9eda5 --- /dev/null +++ b/.vscode/README.md @@ -0,0 +1,64 @@ +# Quickstart: Debugging für open_workshop + +Diese Datei hilft dir, das `open_workshop` Addon schnell in VS Code zu öffnen und sowohl das Addon als auch (optional) den Odoo‑Core zu debuggen. + +Kurzfassung +- Öffne in VS Code den Ordner `extra-addons/open_workshop`. +- Starte die Development-Container/Composer Umgebung mit `./dev.sh` (Option 1 oder 2). +- Verwende die DevContainer‑Funktion oder die Debug‑Konfigurationen unten. + +1) Container starten + +Empfohlen: im Projektstamm (`odoo`) ausführen: + +```bash +./dev.sh +# Option 1: Normal starten (ODOO_DEV=1) +# Option 2: Debug-Modus (ODOO_DEBUG=1) — der Container wartet auf eine Debug-Verbindung +``` + +2) VS Code als DevContainer verbinden (empfohlen) + +- Öffne VS Code im lokalen Ordner `extra-addons/open_workshop`. +- Command Palette → `Dev Containers: Attach to Running Container...` → wähle `odoo-dev`. +- VS Code öffnet den Container als Arbeitsumgebung (remoteUser ist `odoo`). +- Öffne dann das Workspace‑Verzeichnis `/mnt/extra-addons/open_workshop`. + +Vorteil: Du arbeitest direkt im Container (kein lokales Kopieren der Core‑Sourcen nötig) und Breakpoints funktionieren zuverlässig. + +3) Debugging (Attach) + +- Wenn du als DevContainer verbunden bist, verwende die Debug‑Konfiguration "Odoo Attach (container)" (port 5678). +- Wenn du lokal arbeitest und den Host‑Port benutzt, verwende "Odoo Attach (host)" (port 4338). + +4) Pfad‑Mapping + +- Die `launch.json` enthält Pfadabbildungen: + - `${workspaceFolder}` ↔ `/mnt/extra-addons/open_workshop` (dein Addon) + - `${workspaceFolder}/../../odoo-source/odoo` ↔ `/usr/lib/python3/dist-packages/odoo` (falls du lokal eine Kopie des Odoo‑Cores hast) + +Hinweis: Lokale `odoo-source` ist nicht erforderlich, wenn du per DevContainer arbeitest, weil VS Code die Dateien direkt im Container liest. + +5) Troubleshooting + +- Debug-Verbindung schlägt fehl: prüfe, ob der Container im Debug‑Modus läuft und der Port gemappt ist: + +```bash +docker compose -f docker-compose.dev.yaml ps +docker compose -f docker-compose.dev.yaml logs -f odoo-dev +``` + +- VS Code meldet, dass Breakpoints nicht aufgelöst werden: vergewissere dich, dass die `pathMappings` korrekt sind und die lokalen Dateien existieren (oder nutze DevContainer). + +6) Image/Compose aktualisieren + +- Wenn du `Dockerfile.Dev` geändert hast: neu bauen (Option 3 in `./dev.sh`), dann Container neu starten (Option 5 oder down/up). + +7) Kurze Checklist für Mitentwickler + +- `./dev.sh` → Option 3 (einmalig) wenn du das Dev‑Image bauen musst. +- `./dev.sh` → Option 1 oder 2 zum Starten. +- In VS Code: Öffne `extra-addons/open_workshop`, dann `Dev Containers: Attach to Running Container...`. +- Starte Debug mit "Odoo Attach (container)" oder "Odoo Attach (host)". + + diff --git a/.vscode/launch.json b/.vscode/launch.json index 3166ac5..25f4471 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,7 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "Odoo Debug (Remote)", + "name": "Odoo Attach (host)", "type": "debugpy", "request": "attach", "connect": { @@ -12,10 +12,30 @@ "pathMappings": [ { "localRoot": "${workspaceFolder}", - "remoteRoot": "/opt/odoo/workspace/open_workshop" + "remoteRoot": "/mnt/extra-addons/open_workshop" }, { - "localRoot": "${workspaceFolder}/../odoo-source/odoo", + "localRoot": "${workspaceFolder}/../../odoo-source/odoo", + "remoteRoot": "/usr/lib/python3/dist-packages/odoo" + } + ], + "justMyCode": false + }, + { + "name": "Odoo Attach (container)", + "type": "debugpy", + "request": "attach", + "connect": { + "host": "localhost", + "port": 5678 + }, + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "/mnt/extra-addons/open_workshop" + }, + { + "localRoot": "${workspaceFolder}/../../odoo-source/odoo", "remoteRoot": "/usr/lib/python3/dist-packages/odoo" } ], diff --git a/.vscode/settings.json b/.vscode/settings.json index 09976c4..0a1e9b4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,16 @@ +{ + "python.pythonPath": "/usr/bin/python3", + "python.analysis.extraPaths": [ + "${workspaceFolder}", + "${workspaceFolder}/../../odoo-source/odoo" + ], + "python.analysis.typeCheckingMode": "off" +} { "editor.rulers": [80, 100, 120], "files.eol": "\n", "[python]": { - "editor.defaultFormatter": "charliermarsh.ruff", + "editor.defaultFormatter": "ms-python.python", "editor.insertSpaces": true, "editor.tabSize": 4 }, @@ -11,7 +19,7 @@ "editor.tabSize": 2 }, "python.analysis.extraPaths": [ - "../odoo-source/odoo", + "../../odoo-source/odoo", ], "python.testing.pytestArgs": [ "--odoo-http", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index f14b03d..e96ef35 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,71 +4,64 @@ { "label": "start-odoo-dev", "type": "shell", - "command": "docker-compose", - "args": ["-f", "docker-compose.dev.yaml", "up", "-d"], - "group": "build", - "presentation": { - "echo": true, - "reveal": "always", - "focus": false, - "panel": "shared" + "command": "docker", + "args": ["compose", "-f", "${workspaceFolder}/../../odoo/docker-compose.dev.yaml", "up", "-d"], + "options": { + "env": { + "ODOO_DEV": "1" + } }, + "group": { "kind": "build", "isDefault": true }, + "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, "problemMatcher": [] }, { "label": "start-odoo-debug", "type": "shell", - "command": "docker-compose", - "args": ["-f", "docker-compose.dev.yaml", "exec", "-e", "ODOO_DEBUG=1", "odoo-dev", "odoo"], - "group": "build", - "presentation": { - "echo": true, - "reveal": "always", - "focus": false, - "panel": "shared" + "command": "docker", + "args": ["compose", "-f", "${workspaceFolder}/../../odoo/docker-compose.dev.yaml", "up", "-d"], + "options": { + "env": { + "ODOO_DEBUG": "1" + } }, - "problemMatcher": [] - }, - { - "label": "stop-odoo-dev", - "type": "shell", - "command": "docker-compose", - "args": ["-f", "docker-compose.dev.yaml", "down"], "group": "build", - "presentation": { - "echo": true, - "reveal": "always", - "focus": false, - "panel": "shared" - }, + "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, "problemMatcher": [] }, { "label": "rebuild-odoo-dev", "type": "shell", - "command": "docker-compose", - "args": ["-f", "docker-compose.dev.yaml", "up", "--build", "-d"], + "command": "docker", + "args": ["compose", "-f", "${workspaceFolder}/../../odoo/docker-compose.dev.yaml", "up", "--build", "-d"], "group": "build", - "presentation": { - "echo": true, - "reveal": "always", - "focus": false, - "panel": "shared" - }, + "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, + "problemMatcher": [] + }, + { + "label": "stop-odoo-dev", + "type": "shell", + "command": "docker", + "args": ["compose", "-f", "${workspaceFolder}/../..odoo/docker-compose.dev.yaml", "down"], + "group": "build", + "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, "problemMatcher": [] }, { "label": "odoo-logs", "type": "shell", - "command": "docker-compose", - "args": ["-f", "docker-compose.dev.yaml", "logs", "-f", "odoo-dev"], + "command": "docker", + "args": ["compose", "-f", "${workspaceFolder}/../../odoo/docker-compose.dev.yaml", "logs", "-f", "odoo-dev"], "group": "test", - "presentation": { - "echo": true, - "reveal": "always", - "focus": false, - "panel": "shared" - }, + "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" }, + "problemMatcher": [] + }, + { + "label": "shell-odoo", + "type": "shell", + "command": "docker", + "args": ["compose", "-f", "${workspaceFolder}/../../odoo/docker-compose.dev.yaml", "exec", "odoo-dev", "bash"], + "presentation": { "echo": true, "reveal": "always", "focus": true, "panel": "shared" }, "problemMatcher": [] } ] diff --git a/open_workshop.code-workspace b/open_workshop.code-workspace new file mode 100644 index 0000000..e5e670b --- /dev/null +++ b/open_workshop.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../../../usr/lib/python3/dist-packages/odoo" + } + ], + "settings": {} +} \ No newline at end of file diff --git a/static/src/js/ows_pos_customer_sidebar.js b/static/src/js/ows_pos_customer_sidebar.js index 4106a8c..b14b7b6 100644 --- a/static/src/js/ows_pos_customer_sidebar.js +++ b/static/src/js/ows_pos_customer_sidebar.js @@ -22,7 +22,7 @@ export class OwsPosCustomerSidebar extends Component { } async removeCurrentOrder() { - this.pos.onDeleteOrder(order) + this.pos.onDeleteOrder(this.pos.get_order()) } openTicketScreen() {