FIX: pos: wenn auf - gedrückt wird um eine Order zu entfernen, wurde nicht

die Order nicht gefunden. -> behoben
- IMP: "einfachere" Debug Möglichkeit mit odoo-18-dev container. README.md in .vscode
  hinzugefügt.
This commit is contained in:
Matthias Lotz 2025-10-25 14:10:25 +02:00
parent d56ae65b56
commit dff2de1755
7 changed files with 162 additions and 51 deletions

View File

@ -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'"
}

64
.vscode/README.md vendored Normal file
View File

@ -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 OdooCore 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 DevContainerFunktion oder die DebugKonfigurationen 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 WorkspaceVerzeichnis `/mnt/extra-addons/open_workshop`.
Vorteil: Du arbeitest direkt im Container (kein lokales Kopieren der CoreSourcen nötig) und Breakpoints funktionieren zuverlässig.
3) Debugging (Attach)
- Wenn du als DevContainer verbunden bist, verwende die DebugKonfiguration "Odoo Attach (container)" (port 5678).
- Wenn du lokal arbeitest und den HostPort benutzt, verwende "Odoo Attach (host)" (port 4338).
4) PfadMapping
- 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 OdooCores 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 DebugModus 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 DevImage 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)".

26
.vscode/launch.json vendored
View File

@ -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"
}
],

12
.vscode/settings.json vendored
View File

@ -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",

81
.vscode/tasks.json vendored
View File

@ -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"],
"command": "docker",
"args": ["compose", "-f", "${workspaceFolder}/../../odoo/docker-compose.dev.yaml", "up", "-d"],
"options": {
"env": {
"ODOO_DEBUG": "1"
}
},
"group": "build",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"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": []
}
]

View File

@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
},
{
"path": "../../../usr/lib/python3/dist-packages/odoo"
}
],
"settings": {}
}

View File

@ -22,7 +22,7 @@ export class OwsPosCustomerSidebar extends Component {
}
async removeCurrentOrder() {
this.pos.onDeleteOrder(order)
this.pos.onDeleteOrder(this.pos.get_order())
}
openTicketScreen() {