Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .devcontainer/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@
"ODOO_LOGGING_JSON": "0",
// "GEVENT_SUPPORT": "True",
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}/src",
"remoteRoot": "/home/odoo/src"
},
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/home/odoo/custom/repositories"
}
]
}
]
}
67 changes: 33 additions & 34 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
"dockerComposeFile": ["../docker-compose.yml"],
"service": "odoo",
// "workspaceFolder": "/workspace",
"workspaceFolder": "/home/odoo/custom/repositories",
"workspaceFolder": "/home/odoo",
"mounts": [
{
"source": "${localWorkspaceFolder}/.devcontainer/scripts", "target": "/scripts", "type": "bind"
},
{
"source": "${localWorkspaceFolder}/.devcontainer/.vscode", "target": "/home/odoo/custom/repositories/.vscode", "type": "bind"
"source": "${localWorkspaceFolder}/.devcontainer/.vscode", "target": "/home/odoo/.vscode", "type": "bind"
},
{
"source": "${localWorkspaceFolder}/odools.toml", "target": "/home/odoo/odools.toml", "type": "bind"
}
// ,"source=${env:HOME}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,consistency=cached"
],
Expand All @@ -31,18 +34,32 @@
"remoteUser": "odoo",
"settings":{
"files.insertFinalNewline": true,
"terminal.integrated.cwd": "/home/odoo/custom/repositories",
"terminal.integrated.cwd": "/home/odoo",
"remote.autoForwardPorts": false,
// Ignore files in src directory the workspace
"files.watcherExclude": {
"/home/odoo/src/**" : true,
"/home/odoo/custom/repositories/src/**" : true
"/home/odoo/src/**" : true
},
"files.exclude": {
".devcontainer": true,
//".vscode": true,
".github": true,
"*.Dockerfile.dockerignore": true
".bash_aliases": true,
".bash_logout": true,
".bashrc": true,
".cache": true,
".config": true,
".devcontainer": true,
".dotnet": true,
".gitconfig": true,
".local": true,
".profile": true,
".resources": true,
".ssh": true,
".vscode-server": true,
".bash_history": true,
".npm": true,
".ipython": true,
"ODOO_BY_ADHOC_VERSION": true,
"data": true,
"venv": true
},
"search.exclude":{
".devcontainer": true,
Expand All @@ -66,28 +83,6 @@
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
// PyLance
"python.languageServer": "Pylance",
"python.analysis.languageServerMode": "light",
"python.analysis.extraPaths": [
"/home/odoo/src/odoo",
"/home/odoo/src/enterprise",
"/home/odoo/src/odoo-module-migrator",
"/home/odoo/src/odoo-upgrade",
"/home/odoo/src/odooly",
"/home/odoo/src/openupgradelib",
"/home/odoo/src/upgrade-util"
],
// "python.linting.pylintArgs":[],
"python.analysis.exclude": [
// "**"
"/workspace/src/**",
"/home/odoo/custom/repositories/src/**"
],
"python.analysis.autoSearchPaths": true,
"python.analysis.diagnosticMode": "openFilesOnly",
"python.analysis.indexing": true,
"python.analysis.userFileIndexingLimit": -1,
// Spell check
"cSpell.diagnosticLevel": "Hint",
"cSpell.diagnosticLevelFlaggedWords": "Hint",
Expand All @@ -97,6 +92,7 @@
// Debugger
"debug.toolBarLocation": "commandCenter",
"debug.openDebug": "neverOpen",
"debug.internalConsoleOptions": "neverOpen",
"debug.openExplorerOnEnd": true,
"debug.allowBreakpointsEverywhere": true,
"debug.hideLauncherWhileDebugging": true,
Expand All @@ -105,12 +101,14 @@
// Auto Docstring
"autoDocstring.guessTypes": true,
"autoDocstring.docstringFormat": "google",
"autoDocstring.generateDocstringOnEnter": true
"autoDocstring.generateDocstringOnEnter": true,
// Odoo
"Odoo.selectedProfile": "Odoo by Adhoc",
"extensions.ignoreRecommendations": true
},
//Extensions "ms-vscode-remote.vscode-remote-extensionpack"
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.debugpy",
"charliermarsh.ruff",
"eamodio.gitlens",
Expand All @@ -119,7 +117,8 @@
"shardulm94.trailing-spaces",
"streetsidesoftware.code-spell-checker",
"njpwerner.autodocstring",
"trinhanhngoc.vscode-odoo"
"mechatroner.rainbow-csv",
"Odoo.odoo",
]
}
}
Expand Down
40 changes: 18 additions & 22 deletions .devcontainer/scripts/poststart.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
#!/bin/bash

# Fix addons paths
echo "PostStart"
for app in "/home/odoo/custom/repositories/"*; do
if [[ -d $app ]]; then
app_name=$(basename $app)
[[ $app_name == .* || $app_name == src* || $app_name == tmp* ]] && continue
echo "App: $app_name"
for module in "$app/"*; do
if [[ -d $module ]]; then
module_name=$(basename $module)
[[ $module_name == .* || $module_name == src* ]] && continue
echo "ln -sf $module/ /home/odoo/src/$module_name"
if [ ! -L /home/odoo/src/$module_name ]; then
ln -sf $module/ /home/odoo/src/$module_name
echo "Creating symlink for $module_name ln -sf $module/ /home/odoo/src/$module_name"
fi
fi
done
fi
done

if [[ "$AD_DEV_MODE" == "MASTER" ]]; then
echo "Running in master mode"
~/.resources/entrypoint
fi

exit 0
# Update addons paths in odools.toml from odoo.conf
ODOO_CONF="/home/odoo/.config/odoo.conf"
ODOOLS_TOML="/home/odoo/odools.toml"

if [[ -f "$ODOO_CONF" ]]; then
ADDONS_PATH=$(grep "^addons_path" "$ODOO_CONF" | cut -d'=' -f2 | xargs)
if [[ -n "$ADDONS_PATH" && -f "$ODOOLS_TOML" ]]; then
# Convert comma-separated paths to array format
ARRAY_PATHS=$(echo "$ADDONS_PATH" | sed 's/,/","/g' | sed 's/^/["/' | sed 's/$/"]/')
# Create temp file to avoid device busy error on mounted file
TEMP_FILE=$(mktemp)
sed "s|^addons_paths.*|addons_paths = $ARRAY_PATHS|" "$ODOOLS_TOML" > "$TEMP_FILE"
cp "$TEMP_FILE" "$ODOOLS_TOML"
rm "$TEMP_FILE"
fi
fi

exit 0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ tmp/*
.devcontainer/.vscode/settings.json
.devcontainer/workspace/*
!.devcontainer/workspace/.gitkeep
.DS_Store
1 change: 1 addition & 0 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ assume-unchanged() {
git update-index ${OPERATION} $SCRIPT_DIR/.devcontainer/devcontainer.json
git update-index ${OPERATION} $SCRIPT_DIR/.env
git update-index ${OPERATION} $SCRIPT_DIR/docker-compose.yml
git update-index ${OPERATION} $SCRIPT_DIR/odools.toml
# To revert the changes, you can use:
# git update-index --no-assume-unchanged .devcontainer/.vscode/launch.json
}
Expand Down
11 changes: 11 additions & 0 deletions odools.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[config]]
name = "Odoo by Adhoc"
odoo_path = "/home/odoo/src/odoo"
addons_paths = []

[[config.diagnostic_filters]]
codes = ["OLS.*"]
paths = [
"/home/odoo/src/*",
]
path_type = "in"