#!/usr/bin/env bash # # Installs selected content from the downloaded repos into a production folder # # Warning: git apply may fail if /opt/odoo/.git/ exists if [ $UID != 0 ]; then echo "You need administration privileges to run this script." exit 1 fi DESTDIR=/opt/odoo Help () { echo "Usage: $0 [-h] -o={all|core|community}" echo echo "Options:" echo "-h Help (display this text)" echo "-o Modules to be patched (one of 'all', 'core'," echo " 'community'). Required." echo } pt_core () { echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo " Patch core Odoo modules" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" SRC=$PWD DEST=$DESTDIR/core/ OPTIONS="-p1 --verbose" pushd $DEST # Already applied: #git apply $OPTIONS $SRC/patches/20210603_auth-oauth_redirects-to-root.patch #git apply $OPTIONS $SRC/patches/20220131_purchase-requisition_match-variant.patch #git apply $OPTIONS $SRC/patches/20230309_ir-attachment_allow-portal-users-attachment-access.patch #git apply $OPTIONS $SRC/patches/20230425_stock_picking-type-from-return.patch # Included in 2023-03-09 patch: #git apply $OPTIONS $SRC/patches/20230206_ir-attachment_allow-portal-users-attachment-access.patch # Reverted in https://github.com/odoo/odoo/commit/8d1d62a8c0746abb30f97290304b761f74111a89: #git apply $OPTIONS $SRC/patches/20220204_mail_re-enables-buttons-in-notifications.patch git apply $OPTIONS $SRC/patches/20230713_survey_include-post-in-answer.patch popd } pt_community () { echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo " Patch OCA modules" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" # Note: git apply has issues with submodules. Use patch command instead. DEST=$DESTDIR/community/base_location/ OPTIONS="--directory=$DEST --strip=1" patch $OPTIONS < patches/20210821_base-location_no-zip-from-city.patch DEST=$DESTDIR/community/account_invoice_force_number/ OPTIONS="--directory=$DEST --strip=2" patch $OPTIONS < patches/20211216_account-invoice-force-number_post-instead-of-action.patch } pt_all () { pt_core # Apply patches to Odoo core pt_community # Apply patches to OCA modules } set -ueo pipefail if (($# == 0)) then Help exit fi while getopts ":ho:" option; do case $option in h) # display Help Help exit;; o) # Enter a name Modules=$OPTARG;; *) # Invalid option echo "Error: Invalid option" echo Help exit;; esac done case $Modules in 'all') # Apply patches to all modules pt_all exit;; 'core') # Apply patches to Odoo core pt_core exit;; 'community') # Apply patches to OCA modules pt_community exit;; *) # Invalid option echo "Error: Invalid module" echo Help exit;; esac