From 558dff276afb3935a88e31ef36348f3cf9d58341 Mon Sep 17 00:00:00 2001 From: "matthias.lotz" Date: Sun, 5 Oct 2025 20:52:04 +0200 Subject: [PATCH] debugpy option --- .vscode/.jslintrc | 289 ++++++++++++++++++++++++++++++++++++ .vscode/launch.json | 25 ++++ .vscode/odoo.code-workspace | 44 ++++++ .vscode/settings.json | 22 +++ .vscode/tasks.json | 75 ++++++++++ __manifest__.py | 2 +- models/pos_order.py | 4 +- 7 files changed, 458 insertions(+), 3 deletions(-) create mode 100644 .vscode/.jslintrc create mode 100644 .vscode/launch.json create mode 100644 .vscode/odoo.code-workspace create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/.jslintrc b/.vscode/.jslintrc new file mode 100644 index 0000000..452a3f2 --- /dev/null +++ b/.vscode/.jslintrc @@ -0,0 +1,289 @@ +{ + "globals": { + "$": false, + "_": false, + "fuzzy": false, + "jQuery": false, + "moment": false, + "odoo": false, + "openerp": false, + "self": false + }, + "env": { + "browser": true + }, + "rules": { + "no-alert": "error", + "no-array-constructor": "error", + "no-bitwise": "off", + "no-caller": "error", + "no-case-declarations": "error", + "no-catch-shadow": "error", + "no-class-assign": "error", + "no-cond-assign": "error", + "no-confusing-arrow": "error", + "no-console": "error", + "no-const-assign": "error", + "no-constant-condition": "error", + "no-continue": "off", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-div-regex": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-duplicate-imports": "error", + "no-else-return": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-function": "error", + "no-empty-pattern": "error", + "no-eq-null": "error", + "no-eval": "error", + "no-ex-assign": "error", + "no-extend-native": "error", + "no-extra-bind": "error", + "no-extra-boolean-cast": "error", + "no-extra-label": "error", + "no-extra-parens": "error", + "no-extra-semi": "error", + "no-fallthrough": "error", + "no-floating-decimal": "error", + "no-func-assign": "error", + "no-implicit-coercion": ["error", { + "allow": ["~"] + }], + "no-implicit-globals": "error", + "no-implied-eval": "error", + "no-inline-comments": "error", + "no-inner-declarations": "error", + "no-invalid-regexp": "error", + "no-invalid-this": "off", + "no-irregular-whitespace": "error", + "no-iterator": "error", + "no-label-var": "error", + "no-labels": "error", + "no-lone-blocks": "error", + "no-lonely-if": "error", + "no-loop-func": "off", + "no-magic-numbers": "off", + "no-mixed-operators": "error", + "no-mixed-requires": "error", + "no-mixed-spaces-and-tabs": "error", + "no-multi-spaces": "error", + "no-multi-str": "error", + "no-multiple-empty-lines": "error", + "no-native-reassign": "error", + "no-negated-condition": "error", + "no-negated-in-lhs": "error", + "no-nested-ternary": "off", + "no-new": "error", + "no-new-func": "error", + "no-new-object": "error", + "no-new-require": "error", + "no-new-symbol": "error", + "no-new-wrappers": "error", + "no-obj-calls": "error", + "no-octal": "error", + "no-octal-escape": "error", + "no-param-reassign": "error", + "no-path-concat": "error", + "no-plusplus": "off", + "no-process-env": "error", + "no-process-exit": "error", + "no-proto": "error", + "no-prototype-builtins": "error", + "no-redeclare": "error", + "no-regex-spaces": "error", + "no-restricted-globals": "error", + "no-restricted-imports": "error", + "no-restricted-modules": "error", + "no-restricted-syntax": "error", + "no-return-assign": "error", + "no-script-url": "error", + "no-self-assign": "error", + "no-self-compare": "error", + "no-sequences": "error", + "no-shadow": "error", + "no-shadow-restricted-names": "error", + "no-whitespace-before-property": "error", + "no-spaced-func": "error", + "no-sparse-arrays": "error", + "no-sync": "error", + "no-tabs": "error", + "no-ternary": "off", + "no-trailing-spaces": "error", + "no-this-before-super": "error", + "no-throw-literal": "error", + "no-undef": "error", + "no-undef-init": "error", + "no-undefined": "off", + "no-unexpected-multiline": "error", + "no-underscore-dangle": "off", + "no-unmodified-loop-condition": "error", + "no-unneeded-ternary": "error", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unused-expressions": "error", + "no-unused-labels": "error", + "no-unused-vars": "error", + "no-use-before-define": "error", + "no-useless-call": "error", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-constructor": "error", + "no-useless-escape": "error", + "no-useless-rename": "error", + "no-void": "error", + "no-var": "off", + "no-warning-comments": "off", + "no-with": "error", + "array-bracket-spacing": "off", + "array-callback-return": "error", + "arrow-body-style": "error", + "arrow-parens": "error", + "arrow-spacing": "off", + "accessor-pairs": "error", + "block-scoped-var": "off", + "block-spacing": ["error", "always"], + "brace-style": "error", + "callback-return": "error", + "camelcase": "off", + "capitalized-comments": ["error", "always", { + "ignoreConsecutiveComments": true, + "ignoreInlineComments": true + }], + "comma-dangle": ["error", "always-multiline"], + "comma-spacing": ["error", { + "before": false, + "after": true + }], + "comma-style": "error", + "complexity": [ + "error", + 15 + ], + "computed-property-spacing": "off", + "consistent-return": "off", + "consistent-this": "off", + "constructor-super": "error", + "curly": "error", + "default-case": "off", + "dot-location": ["error", "property"], + "dot-notation": "error", + "eol-last": "error", + "eqeqeq": "error", + "func-names": "off", + "func-style": "off", + "generator-star-spacing": "off", + "global-require": "error", + "guard-for-in": "off", + "handle-callback-err": "error", + "id-blacklist": "error", + "id-length": "off", + "id-match": "error", + "indent": "error", + "init-declarations": "error", + "jsx-quotes": "error", + "key-spacing": "off", + "keyword-spacing": "error", + "linebreak-style": [ + "error", + "unix" + ], + "lines-around-comment": "error", + "max-depth": "error", + "max-len": ["error", { + "code": 80, + "ignorePattern": "odoo\\.define\\(", + "tabWidth": 4 + }], + "max-lines": "off", + "max-nested-callbacks": "error", + "max-params": "off", + "max-statements": "off", + "max-statements-per-line": "error", + "multiline-ternary": "off", + "new-cap": "off", + "new-parens": "error", + "newline-after-var": "off", + "newline-before-return": "off", + "newline-per-chained-call": "off", + "object-curly-newline": ["error", { "consistent": true }], + "object-curly-spacing": ["error", "never"], + "object-property-newline": ["error", { + "allowAllPropertiesOnSameLine": true + }], + "object-shorthand": "off", + "one-var": "off", + "one-var-declaration-per-line": "off", + "operator-assignment": "error", + "operator-linebreak": "error", + "padded-blocks": "off", + "prefer-arrow-callback": "off", + "prefer-const": "error", + "prefer-reflect": "off", + "prefer-rest-params": "off", + "prefer-spread": "off", + "prefer-template": "off", + "quote-props": "off", + "quotes": "off", + "radix": "error", + "require-yield": "error", + "rest-spread-spacing": "off", + "semi": [ + "error", + "always" + ], + "semi-spacing": "error", + "sort-imports": "error", + "sort-vars": "off", + "space-before-blocks": "error", + "space-before-function-paren": "error", + "space-in-parens": "off", + "space-infix-ops": "off", + "space-unary-ops": "off", + "spaced-comment": ["error", "always"], + "strict": ["error", "function"], + "template-curly-spacing": "off", + "unicode-bom": "error", + "use-isnan": "error", + "valid-jsdoc": ["error", { + "prefer": { + "arg": "param", + "argument": "param", + "augments": "extends", + "constructor": "class", + "exception": "throws", + "func": "function", + "method": "function", + "prop": "property", + "return": "returns", + "virtual": "abstract", + "yield": "yields" + }, + "preferType": { + "array": "Array", + "bool": "Boolean", + "boolean": "Boolean", + "number": "Number", + "object": "Object", + "str": "String", + "string": "String" + }, + "requireParamDescription": false, + "requireReturn": false, + "requireReturnDescription": false, + "requireReturnType": false + }], + "valid-typeof": "error", + "vars-on-top": "off", + "wrap-iife": "error", + "wrap-regex": "error", + "yield-star-spacing": "off", + "yoda": "error" + }, + "parserOptions": {} +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..b40fc41 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Odoo Debug (Remote)", + "type": "debugpy", + "request": "attach", + "connect": { + "host": "localhost", + "port": 5678 + }, + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "/opt/odoo/workspace/open_workshop" + }, + { + "localRoot": "${workspaceFolder}/../odoo-source/odoo", + "remoteRoot": "/usr/lib/python3/dist-packages/odoo" + } + ], + "justMyCode": false + } + ] +} diff --git a/.vscode/odoo.code-workspace b/.vscode/odoo.code-workspace new file mode 100644 index 0000000..0e4caa1 --- /dev/null +++ b/.vscode/odoo.code-workspace @@ -0,0 +1,44 @@ +// 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" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..afba01b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,22 @@ +{ + "editor.rulers": [80, 100, 120], + "files.eol": "\n", + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff", + "editor.insertSpaces": true, + "editor.tabSize": 4 + }, + "[javascript]": { + "editor.insertSpaces": true, + "editor.tabSize": 2 + }, + "python.analysis.extraPaths": [ + "../odoo", + ], + "python.testing.pytestArgs": [ + "--odoo-http", + "./addons/template" + ], + "python.testing.pytestEnabled": true, + "python.testing.unittestEnabled": false +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..f14b03d --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,75 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "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" + }, + "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" + }, + "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" + }, + "problemMatcher": [] + }, + { + "label": "rebuild-odoo-dev", + "type": "shell", + "command": "docker-compose", + "args": ["-f", "docker-compose.dev.yaml", "up", "--build", "-d"], + "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"], + "group": "test", + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared" + }, + "problemMatcher": [] + } + ] +} diff --git a/__manifest__.py b/__manifest__.py index 8318530..d6d265d 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,7 +1,7 @@ { 'name': 'POS Open Workshop', 'license': 'AGPL-3', - 'version': '18.0.1.0.0', + 'version': '18.0.1.0.1', 'summary': 'Erstellt Maschinenfreigaben basierend auf POS-Einweisungsprodukten', 'depends': ['base', 'account','product','sale','contacts','point_of_sale'], 'author': 'matthias.lotz', diff --git a/models/pos_order.py b/models/pos_order.py index 71ae7c2..0f3e9ec 100644 --- a/models/pos_order.py +++ b/models/pos_order.py @@ -1,13 +1,13 @@ from odoo import models, fields, api from collections import defaultdict -#import debugpy +import debugpy import logging _logger = logging.getLogger(__name__) _logger.info("✅ pos_order.py geladen") -# debugpy.listen(("0.0.0.0", 5678)) +#debugpy.listen(("0.0.0.0", 5678)) print("✅ debugpy wartet auf Verbindung (Port 5678) ...") # Optional: Starte erst, wenn VS Code verbunden ist #debugpy.wait_for_client()