diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 00000000..bac9f68e --- /dev/null +++ b/.pylintrc @@ -0,0 +1,120 @@ +[MASTER] +load-plugins=pylint_odoo +score=n + +[ODOOLINT] +manifest_required_authors=Hibou Corp. +manifest_required_keys=license +manifest_deprecated_keys=description,active +license_allowed=OPL-1,AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 +valid_odoo_versions=15.0 + +[MESSAGES CONTROL] +disable=all + +# This .pylintrc contains optional AND mandatory checks and is meant to be +# loaded in an IDE to have it check everything, in the hope this will make +# optional checks more visible to contributors who otherwise never look at a +# green travis to see optional checks that failed. +# .pylintrc-mandatory containing only mandatory checks is used the pre-commit +# config as a blocking check. + +enable=anomalous-backslash-in-string, + api-one-deprecated, + api-one-multi-together, + assignment-from-none, + attribute-deprecated, + class-camelcase, + dangerous-default-value, + dangerous-view-replace-wo-priority, + development-status-allowed, + duplicate-id-csv, + duplicate-key, + duplicate-xml-fields, + duplicate-xml-record-id, + eval-referenced, + eval-used, + incoherent-interpreter-exec-perm, + license-allowed, + manifest-author-string, + manifest-deprecated-key, + manifest-required-author, + manifest-required-key, + manifest-version-format, + method-compute, + method-inverse, + method-required-super, + method-search, + openerp-exception-warning, + pointless-statement, + pointless-string-statement, + print-used, + redundant-keyword-arg, + redundant-modulename-xml, + reimported, + relative-import, + return-in-init, + rst-syntax-error, + sql-injection, + too-few-format-args, + translation-field, + translation-required, + unreachable, + use-vim-comment, + wrong-tabs-instead-of-spaces, + xml-syntax-error, + attribute-string-redundant, + character-not-valid-in-resource-link, + consider-merging-classes-inherited, + context-overridden, + create-user-wo-reset-password, + dangerous-filter-wo-user, + dangerous-qweb-replace-wo-priority, + deprecated-data-xml-node, + deprecated-openerp-xml-node, + duplicate-po-message-definition, + except-pass, + file-not-used, + invalid-commit, + manifest-maintainers-list, + missing-newline-extrafiles, + missing-readme, + missing-return, + odoo-addons-relative-import, + old-api7-method-defined, + po-msgstr-variables, + po-syntax-error, + renamed-field-parameter, + resource-not-exist, + str-format-used, + test-folder-imported, + translation-contains-variable, + translation-positional-used, + unnecessary-utf8-coding-comment, + website-manifest-key-not-valid-uri, + xml-attribute-translatable, + xml-deprecated-qweb-directive, + xml-deprecated-tree-attribute, + # messages that do not cause the lint step to fail + consider-merging-classes-inherited, + create-user-wo-reset-password, + dangerous-filter-wo-user, + deprecated-module, + file-not-used, + invalid-commit, + missing-manifest-dependency, + missing-newline-extrafiles, + missing-readme, + no-utf8-coding-comment, + odoo-addons-relative-import, + old-api7-method-defined, + redefined-builtin, + too-complex, + unnecessary-utf8-coding-comment + + +[REPORTS] +msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} +output-format=colorized +reports=no + diff --git a/.theia/launch.json b/.theia/launch.json new file mode 100644 index 00000000..287b3398 --- /dev/null +++ b/.theia/launch.json @@ -0,0 +1,113 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + }, + { + "name": "Odoo: shell", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-run.py", + "args": ["shell", "--no-xmlrpc"], + "console": "integratedTerminal" + }, + { + "name": "Odoo: TEST 'sale'", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-run.py", + "args": ["-i", "sale", + "-u", "sale", + "--test-enable", "--no-xmlrpc", "--stop-after-init"], + "console": "integratedTerminal" + }, + { + "name": "Odoo: INIT 'hr_commission'", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-run.py", + "args": ["-i", "hr_commission", + "-u", "hr_commission", + "--stop-after-init"], + "console": "integratedTerminal" + }, + { + "name": "Odoo: TEST 'hr_commission'", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-run.py", + "args": ["-i", "hr_commission", + "-u", "hr_commission", + "--test-enable", "--no-xmlrpc", "--stop-after-init"], + "console": "integratedTerminal" + }, + { + "name": "Odoo: INIT 'hr_payroll_hibou'", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-run.py", + "args": ["-i", "hr_payroll_hibou", + "-u", "hr_payroll_hibou", + "--stop-after-init"], + "console": "integratedTerminal" + }, + { + "name": "Odoo: TEST 'hr_payroll_hibou'", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-run.py", + "args": ["-i", "hr_payroll_hibou", + "-u", "hr_payroll_hibou", + "--test-enable", "--no-xmlrpc", "--stop-after-init"], + "console": "integratedTerminal" + }, + { + "name": "Odoo: server", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-run.py", + "args": [], + "console": "integratedTerminal" + }, + { + "name": "Odoo: Locust Load Testing", + "type": "python", + "request": "launch", + "program": "/flow/odoo/Locust/entrypoint.py", + "args": [ + // -f /path/to/locustfiles.py + // -d more-specific-db + "--user", "admin", + "--pass", "admin", + "--host", "localhost", + "--port", "8069", + "--proto", "jsonrpc" + ], + "console": "integratedTerminal" + }, + { + "name": "Odoo: reload foreground server", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-reload.py", + "args": [], + "console": "integratedTerminal" + }, + { + "name": "Odoo: reload foreground server, Kill Others", + "type": "python", + "request": "launch", + "program": "/opt/odoo/hibou-suite/odoo-reload.py", + "args": ["KILL_OTHER"], + "console": "integratedTerminal" + } + ] +} + diff --git a/.theia/settings.json b/.theia/settings.json new file mode 100644 index 00000000..db8877e9 --- /dev/null +++ b/.theia/settings.json @@ -0,0 +1,18 @@ +{ + "workbench.colorTheme": "Hibou Dark", + "files.exclude": { + "**/.var": true, + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/*.pyc": {"when": "$(basename).py"}, + "**/__pycache__": true + }, + "files.watcherExclude": { + "**/.git/objects/**": true, + "**/.git/subtree-cache/**": true, + "**/node_modules/**": true + } +} diff --git a/odoo-reload.py b/odoo-reload.py new file mode 100755 index 00000000..c8a46c87 --- /dev/null +++ b/odoo-reload.py @@ -0,0 +1,42 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. + +import psutil +import os +import signal +import sys + +# once upon a time +# we tried to find 'odoo' and 'python' +# but sometimes, it would be something like "/usr/local/bin/...." +# so we now just try not to signal/kill 'node' +PID = 1 +PNAME = 'node' +KILL_OTHER = sys.argv[1] == 'KILL_OTHER' if len(sys.argv) >= 2 else False +if KILL_OTHER: + print('Will find other Odoo Processes and Kill them.') + +is_foreground = False +foreground_name = '' +for proc in psutil.process_iter(): + try: + process_name = proc.name() + process_id = proc.pid + print('Inspecting %s:%s' % (process_id, process_name)) + if process_id == PID: + is_foreground = process_name != PNAME + foreground_name = process_name + if not KILL_OTHER: + break + if process_id != PID and KILL_OTHER and process_name != PNAME: + print('Killing %s:%s' % (process_id, process_name)) + os.kill(process_id, signal.SIGKILL) + except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): + pass + +if not is_foreground: + print('Odoo is not the foreground process.') + exit(-1) + +print('Signalling reload to foreground process "%s"' % (foreground_name, )) +os.kill(PID, signal.SIGHUP) + diff --git a/odoo-run.py b/odoo-run.py new file mode 100755 index 00000000..7984b22d --- /dev/null +++ b/odoo-run.py @@ -0,0 +1,5 @@ +__import__('os').environ['TZ'] = 'UTC' +import odoo + +if __name__ == "__main__": + odoo.cli.main()