refactor addons path

This commit is contained in:
Janik von Rotz committed 2023-08-28 09:31:41 +02:00
1 parent d0b9ee1765
commit fc21cdde51
9 files changed
+48 -42

No files matched your search

+4 -8
View File
@@ -82,10 +82,6 @@
path = oca/sale-workflow
url = git@github.com:OCA/sale-workflow.git
branch = 16.0
[submodule "oca/dms"]
path = oca/dms
url = git@github.com:OCA/dms.git
branch = 16.0
[submodule "oca/social"]
path = oca/social
url = git@github.com:OCA/social.git
@@ -226,11 +222,11 @@
path = oca/sale-reporting
url = https://github.com/OCA/sale-reporting.git
branch = 16.0
[submodule "oca/survey"]
path = oca/survey
url = git@github.com:OCA/survey.git
branch = 16.0
[submodule "oca/account-reconcile"]
path = oca/account-reconcile
url = git@github.com:OCA/account-reconcile.git
branch = 16.0
[submodule "oca/survey"]
path = oca/survey
url = git@github.com:OCA/survey.git
branch = 16.0
+8
View File
@@ -100,6 +100,14 @@ Scaffold a new module.
task create-module addons/project_report
```
**Add custom module path**
Update the `.env` file with the module path.
```bash
ODOO_ADDONS_PATH=,addons/survey
```
### Docker
Run Odoo with Docker container.
-1
View File
@@ -1,5 +1,4 @@
[options]
addons_path = odoo/addons,enterprise,themes,odoo,oca/partner-contact,addons/server_tools,addons/project,oca/project,oca/web,oca/timesheet,oca/crm,oca/knowledge,oca/server-auth,oca/server-backend,oca/server-ux,oca/brand,oca/hr,oca/website,oca/reporting-engine,oca/server-tools,oca/product-attribute,oca/sale-workflow,oca/dms,oca/social,oca/bank-statement-import,oca/rest-framework,oca/contract,oca/purchase-workflow,oca/stock-logistics-warehouse,oca/account-invoicing,oca/server-env,oca/business-requirement,oca/connector,oca/edi,oca/community-data-files,oca/account-financial-reporting,oca/iot,oca/manufacture,oca/account-closing,oca/account-financial-tools,oca/bank-payment,addons/odoo_apps_partner,addons/sale_workflow,oca/credit-control,addons/hr,addons/manufacture,addons/stock_logistics_workflow,addons/swiss_payroll,oca/stock-logistics-workflow,addons/website,addons/product_attribute,addons/partner_contact,addons/vertical_saas,addons/social,addons/vertical_job_portal,oca/management-system,oca/hr-holidays,oca/sale-reporting,oca/survey,oca/account-reconcile
admin_passwd = $pbkdf2-sha512$25000$v7dWau29F0LIee/9n/M.pw$uB2sLuvV7I.QlnLCYlR1enNps2D.chZbzavM2g/MAsMXgfkx/AC2X8sTejf4zfe21yOSPOpmdhWTgQSoYqGAPA
limit_time_real = 600
db_host = localhost
Submodule oca/dms deleted from c4a707a565.
+1 -1
Submodule odoo updated: 1ef67b6734...5fee3538ad.
+32 -28
View File
@@ -27,6 +27,28 @@ if [[ -a ".env" ]]; then
export $(cat .env | sed 's/#.*//g' | xargs)
fi
function set-addons-path() {
# Read addons path list
ADDONS_PATH="$(git config --file .gitmodules --get-regexp path | awk '{ print $2 }' | tr '\n' ',' | sed 's/,*$//g')"
# Append env var
ADDONS_PATH="${ADDONS_PATH}${ODOO_ADDONS_PATH}"
# Check if dir exists
for ADDON in $ADDONS_PATH; do
if [ -d "$ADDON" ]; then
echo "Path does not exist: $ADDON"
exit 1
fi
done
# Convert to docker paths
DOCKER_ADDONS_PATH="$(echo "$ADDONS_PATH" | sed 's|,|,/mnt/|g' | sed 's|,/mnt/odoo||g')"
# Replace odoo path
ADDONS_PATH="$(echo "$ADDONS_PATH" | sed 's|,odoo,|,odoo/addons,|g')"
}
function update-readme() {
if test -z "$1"; then echo "\$1 is empty."; exit; fi
FILE_NAME=$(basename "$1")
@@ -169,13 +191,11 @@ function open-url-with-delay(){
xdg-open $1
}
# function share-filestore(){
# sudo chmod o+rwx -R ~/.local/share/Odoo/filestore
# }
function start() {
DATABASE=$2
set-addons-path
# Use default database if second param is not given
DATABASE=$2
if test -z "$2"; then
DATABASE="$GIT_BRANCH"
fi
@@ -216,8 +236,9 @@ function start() {
locale
activate-venv
echo "Open http://localhost:8069 url in your browser."
echo $ADDONS_PATH
open-url-with-delay "http://localhost:8069/web?db=$DATABASE" &
odoo-bin --config 'config/odoo-native.conf' --dev=all --log-handler odoo.tools.convert:DEBUG
odoo-bin --config 'config/odoo-native.conf' --addons-path="$ADDONS_PATH" --dev=all --log-handler odoo.tools.convert:DEBUG
fi
if [[ "$1" =~ "mail" ]]; then
@@ -278,7 +299,7 @@ function init-db() {
locale
activate-venv
# share-filestore
echo "Make sure only one odoo process is running when initalizing the database."
odoo-bin --init base -d $DATABASE --config 'config/odoo-native.conf' --stop-after-init --no-http --load-language $ODOO_LANGUAGE
}
@@ -300,13 +321,6 @@ function lint-module() {
find $1 -type d -exec chmod u=rwx,go=rx {} \;
find $1 -type f -exec chmod u=rw,go=r {} \;
# echo "Copy default configuration files"
# cp template/{.flake8,.gitignore,.isort.cfg,.pre-commit-config.yaml,.pylintrc} $1/../
# echo "Run pylint in $1"
# cd $1
# pylint --load-plugins=pylint_odoo -d all -e odoolint $1 --valid-odoo-versions=$GIT_BRANCH
echo "Run pre-commit in $1"
cd $1
pre-commit run --files ./*
@@ -320,7 +334,6 @@ function lint-module() {
function update-module() {
if test -z "$1"; then echo "\$1 is empty."; exit; fi
# if test -z "$2"; then echo "\$2 is empty."; exit; fi
DATABASE=$1
MODULE_NAME=$(basename $2)
@@ -339,7 +352,6 @@ function update-module() {
function generate-module-translation() {
if test -z "$1"; then echo "\$1 is empty."; exit; fi
# if test -z "$2"; then echo "\$2 is empty."; exit; fi
DATABASE=$1
MODULE_PATH=$2
@@ -838,21 +850,13 @@ function remove-submodule() {
function update-config() {
# Read addons path list
ADDONS="$(git config --file .gitmodules --get-regexp path | awk '{ print $2 }' | tr '\n' ',' | sed 's/,*$//g')"
set-addons-path
# Check if dir exists
for ADDON in $ADDONS; do
if [ -d "$ADDON" ]; then
echo "Path does not exist: $ADDON"
exit 1
fi
done
# Update native config
sed -i'' -e "s|addons_path.*|addons_path = odoo/addons,$ADDONS|g" "./config/odoo-native.conf"
ADDONS="$(echo "$ADDONS" | sed 's|,|,/mnt/|g' | sed 's|,/mnt/odoo||g')"
sed -i'' -e "s|addons_path.*|addons_path = $ADDONS_PATH|g" "./config/odoo-native.conf"
# Update docker config
sed -i'' -e "s|addons_path.*|addons_path = /mnt/$ADDONS|g" "./config/odoo.conf"
sed -i'' -e "s|addons_path.*|addons_path = /mnt/$DOCKER_ADDONS_PATH|g" "./config/odoo.conf"
echo "Config updated."
}