FIX: Add VS Code debugging configuration and fix pos_order.py

- Added .vscode/launch.json with remote debugging setup for Odoo development
- Configured debugpy attachment on port 4338 with path mappings
- Added workspace settings for Python development with Odoo
- Fixed issues in pos_order.py for improved POS functionality
- Enhanced development workflow with breakpoint support for custom code and Odoo core
This commit is contained in:
Matthias Lotz 2025-10-06 19:54:24 +02:00
parent 558dff276a
commit 1069630e86
4 changed files with 8 additions and 51 deletions

2
.vscode/launch.json vendored
View File

@ -7,7 +7,7 @@
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
"port": 4338
},
"pathMappings": [
{

View File

@ -1,44 +0,0 @@
// workspace template to use if you want to run with your local odoo sources
{
"folders": [
{
"name": "project",
"path": ".."
},
{
"name": "odoo",
"path": "../../odoo"
},
{
"name": "odoo-addons",
"path": "../../odoo-addons"
}
],
"launch": {
"configurations": [
{
"name": "Python Attach 41234",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "127.0.0.1",
"port": 41234
},
"pathMappings": [
{
"localRoot": "${workspaceFolder:project}/addons",
"remoteRoot": "/mnt/extra-addons"
},
{
"localRoot": "${workspaceFolder:odoo}",
"remoteRoot": "/opt/odoo"
},
{
"localRoot": "${workspaceFolder:odoo-addons}",
"remoteRoot": "/opt/odoo-addons"
}
]
}
]
}
}

View File

@ -11,12 +11,12 @@
"editor.tabSize": 2
},
"python.analysis.extraPaths": [
"../odoo",
"../odoo-source/odoo",
],
"python.testing.pytestArgs": [
"--odoo-http",
"./addons/template"
"."
],
"python.testing.pytestEnabled": true,
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": false
}

View File

@ -5,7 +5,7 @@ import debugpy
import logging
_logger = logging.getLogger(__name__)
_logger.info("✅ pos_order.py geladen")
_logger.info("✅ pos_order.py geladen Test 2")
#debugpy.listen(("0.0.0.0", 5678))
print("✅ debugpy wartet auf Verbindung (Port 5678) ...")
@ -15,8 +15,9 @@ print("✅ debugpy wartet auf Verbindung (Port 5678) ...")
class PosOrder(models.Model):
_inherit = 'pos.order'
def _process_order(self, order, draft, existing_order):
pos_order_id = super(PosOrder, self)._process_order(order, draft, existing_order)
def _process_order(self, order, existing_order):
_logger.info("🚨 DEBUG: _process_order wurde aufgerufen mit order: %s", order.get('name', 'unbekannt'))
pos_order_id = super(PosOrder, self)._process_order(order, existing_order)
pos_order = self.browse(pos_order_id)
training_products = self.env['ows.machine.training'].search([])