Skip to content

Commit 9caa692

Browse files
[CP] adding missing files
1 parent fe84102 commit 9caa692

6 files changed

Lines changed: 225 additions & 0 deletions

File tree

19.0/tools/odoo-update

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
# #!/usr/bin/env python3
4+
# """
5+
# Update Odoo module
6+
#
7+
# This script proceed to a manual update of one or more Odoo modules in the database.
8+
#
9+
# NOTE: this command is handy to quickly test updates during some development iterations,
10+
# however keep in mind that on Odoo.sh the convention is to increase a module's
11+
# version number in it's manifest file whenever the committed changes requires
12+
# a database upgrade. Please refer to the documentation for more details:
13+
# https://www.odoo.sh/doc/getting_started/branches.html#production
14+
#
15+
#
16+
# Usage:
17+
# odoo-update [--help] <module>
18+
#
19+
# Options:
20+
# -h, --help Show this screen and exit.
21+
# <module> Module list to update separated by comma.
22+
# Use 'all' as module name to update all modules at once.
23+
# """
24+
# import os
25+
# import sys
26+
# import docopt
27+
# argv = sys.argv[1:] or ['-h']
28+
# args = docopt.docopt(__doc__, argv=argv)
29+
# cmd = ['/opt/odoo.sh/odoosh/bin/odoo-bin', '-u', args['<module>'], '--stop-after-init', '--no-http']
30+
# os.execv(cmd[0], cmd)
31+
32+
33+
34+
# Check if a database name is provided
35+
if [ -z "$1" ]; then
36+
echo "⚠️ Please provide the database name as an argument."
37+
echo "Usage:"
38+
echo " odoo-update my_database"
39+
exit 1
40+
fi
41+
42+
43+
CMD="/var/lib/odoo/odoo-bin"
44+
DB_NAME="$1"
45+
# Path to the Odoo configuration file (change this if needed)
46+
CONFIG_FILE="/etc/odoo/odoo.conf"
47+
GLOBAL_OPTIONS="--stop-after-init --without-demo=all --no-http"
48+
49+
50+
# Run the update
51+
echo "🚀 Updating database: $DB_NAME ..."
52+
$CMD -c "$CONFIG_FILE" -d "$DB_NAME" -u all $GLOBAL_OPTIONS
53+
54+
# Check the result
55+
if [ $? -eq 0 ]; then
56+
echo "✅ Update completed successfully."
57+
else
58+
echo "❌ An error occurred during the update."
59+
fi
60+
61+
62+

19.0/tools/odoonix-backup

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
# Check if a database name is provided
4+
if [ -z "$1" ]; then
5+
echo "⚠️ Please provide the database name as an argument."
6+
echo "Usage:"
7+
echo " odoonix-backup my_database"
8+
exit 1
9+
fi
10+
11+
12+
CMD="/var/lib/odoo/odoo-bin"
13+
DB_NAME="$1"
14+
# Path to the Odoo configuration file (change this if needed)
15+
CONFIG_FILE="/etc/odoo/odoo.conf"
16+
GLOBAL_OPTIONS="--stop-after-init --without-demo=all --no-http"
17+
18+
BACKUP_FILENAME="/var/lib/odoo-data/backup/${DB_NAME}-$(date +%s).zip"
19+
20+
21+
# Run the update
22+
echo "🚀 Backup database: $DB_NAME ..."
23+
$CMD db \
24+
-c "$CONFIG_FILE" \
25+
dump "$DB_NAME" \
26+
"$BACKUP_FILENAME"
27+
28+
# Check the result
29+
if [ $? -eq 0 ]; then
30+
echo "✅ Backup completed successfully."
31+
else
32+
echo "❌ An error occurred during the update."
33+
fi

19.0/tools/odoonix-drop

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Check if a database name is provided
4+
if [ -z "$1" ]; then
5+
echo "⚠️ Please provide the database name as an argument."
6+
echo "Usage:"
7+
echo " odoonix-duplicate my_database target_database"
8+
exit 1
9+
fi
10+
11+
12+
CMD="/var/lib/odoo/odoo-bin"
13+
DB_NAME="$1"
14+
DB_TARGET_NAME="$2"
15+
# Path to the Odoo configuration file (change this if needed)
16+
CONFIG_FILE="/etc/odoo/odoo.conf"
17+
GLOBAL_OPTIONS="--stop-after-init --without-demo=all --no-http"
18+
19+
20+
# Run the update
21+
echo "🚀 duplicate database: $DB_NAME ..."
22+
$CMD db \
23+
-c "$CONFIG_FILE" \
24+
drop "$DB_NAME"
25+
26+
# Check the result
27+
if [ $? -eq 0 ]; then
28+
echo "✅ duplicate completed successfully."
29+
else
30+
echo "❌ An error occurred during the update."
31+
fi
32+

19.0/tools/odoonix-duplicate

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Check if a database name is provided
4+
if [ -z "$1" ]; then
5+
echo "⚠️ Please provide the database name as an argument."
6+
echo "Usage:"
7+
echo " odoonix-duplicate my_database target_database"
8+
exit 1
9+
fi
10+
11+
12+
CMD="/var/lib/odoo/odoo-bin"
13+
DB_NAME="$1"
14+
DB_TARGET_NAME="$2"
15+
# Path to the Odoo configuration file (change this if needed)
16+
CONFIG_FILE="/etc/odoo/odoo.conf"
17+
GLOBAL_OPTIONS="--stop-after-init --without-demo=all --no-http"
18+
19+
20+
# Run the update
21+
echo "🚀 duplicate database: $DB_NAME ..."
22+
$CMD db \
23+
-c "$CONFIG_FILE" \
24+
duplicate "$DB_NAME" \
25+
"$DB_TARGET_NAME"
26+
27+
# Check the result
28+
if [ $? -eq 0 ]; then
29+
echo "✅ duplicate completed successfully."
30+
else
31+
echo "❌ An error occurred during the update."
32+
fi

19.0/tools/odoonix-load

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Check if a database name is provided
4+
if [ -z "$1" ]; then
5+
echo "⚠️ Please provide the database name as an argument."
6+
echo "Usage:"
7+
echo " odoonix-backup my_database"
8+
exit 1
9+
fi
10+
11+
12+
CMD="/var/lib/odoo/odoo-bin"
13+
DB_NAME="$1"
14+
# Path to the Odoo configuration file (change this if needed)
15+
CONFIG_FILE="/etc/odoo/odoo.conf"
16+
GLOBAL_OPTIONS="--stop-after-init --without-demo=all --no-http"
17+
18+
BACKUP_FILENAME="/var/lib/odoo-data/backup/${DB_NAME}"
19+
20+
21+
# Run the update
22+
echo "🚀 Backup database: $DB_NAME ..."
23+
$CMD db \
24+
-c "$CONFIG_FILE" \
25+
load "$BACKUP_FILENAME"
26+
27+
# Check the result
28+
if [ $? -eq 0 ]; then
29+
echo "✅ Backup completed successfully."
30+
else
31+
echo "❌ An error occurred during the update."
32+
fi

19.0/tools/odoonix-rename

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Check if a database name is provided
4+
if [ -z "$1" ]; then
5+
echo "⚠️ Please provide the database name as an argument."
6+
echo "Usage:"
7+
echo " odoonix-duplicate my_database target_database"
8+
exit 1
9+
fi
10+
11+
12+
CMD="/var/lib/odoo/odoo-bin"
13+
DB_NAME="$1"
14+
DB_TARGET_NAME="$2"
15+
# Path to the Odoo configuration file (change this if needed)
16+
CONFIG_FILE="/etc/odoo/odoo.conf"
17+
GLOBAL_OPTIONS="--stop-after-init --without-demo=all --no-http"
18+
19+
20+
# Run the update
21+
echo "🚀 duplicate database: $DB_NAME ..."
22+
$CMD db \
23+
-c "$CONFIG_FILE" \
24+
rename "$DB_NAME" \
25+
"$DB_TARGET_NAME"
26+
27+
# Check the result
28+
if [ $? -eq 0 ]; then
29+
echo "✅ duplicate completed successfully."
30+
else
31+
echo "❌ An error occurred during the update."
32+
fi
33+
34+

0 commit comments

Comments
 (0)