35 lines
802 B
Bash
Executable File
35 lines
802 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Get script name
|
|
SCRIPT=$(basename "$0")
|
|
|
|
# First param is docker container
|
|
CONTAINER=odoo36
|
|
|
|
# Default configuration
|
|
PACKAGE_PATH="/usr/lib/python3/dist-packages/"
|
|
|
|
# Custom configuration
|
|
FILE_PATH="${PACKAGE_PATH}odoo/addons/base/models/ir_actions_report.py"
|
|
FIND="if report_sudo.attachment and set(res_ids_wo_stream) != set(html_ids):"
|
|
REPLACE="if not report_sudo.attachment and set(res_ids_wo_stream) != set(html_ids):"
|
|
|
|
# Get filename
|
|
FILE=$(basename "$FILE_PATH")
|
|
|
|
# Copy from docker
|
|
docker cp "$CONTAINER":"$FILE_PATH" .
|
|
|
|
# Find and replace
|
|
sed -i'' "s/$FIND/$REPLACE/g" $FILE
|
|
|
|
# Copy back to docker
|
|
docker cp $FILE "$CONTAINER":"$FILE_PATH"
|
|
|
|
# Remove file
|
|
rm -f $FILE
|
|
|
|
# Register patch installation
|
|
echo "Patch $SCRIPT applied."
|
|
touch "/etc/odoo/${SCRIPT}_${CONTAINER}_installed"
|