diff --git a/DOLIBARR_PACKAGES/apply_patch.sh b/DOLIBARR_PACKAGES/apply_patch.sh
new file mode 100644
index 0000000000000000000000000000000000000000..e15f5a1035b04b342675023b4a6a0f18dbae5ee9
--- /dev/null
+++ b/DOLIBARR_PACKAGES/apply_patch.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+echo "Fixing Dolibarr bug #7420"
+sed -i.bak "178s@'\(__[^_]*__\)'@'/\1/'@g"  /usr/share/dolibarr/htdocs/includes/odtphp/Segment.php
diff --git a/installDolibarr.sh b/installDolibarr.sh
index 7d28fac585aa7ab528139d93f5cd6815e0f87d4d..7892d7fc9effe43e2b0a50d33a3aa1fd16096b55 100644
--- a/installDolibarr.sh
+++ b/installDolibarr.sh
@@ -182,4 +182,6 @@ fi
 echo "cd ${SCRIPT_DIRECTORY}"
 cd ${SCRIPT_DIRECTORY}
 
+[ -f "DOLIBARR_PACKAGES/apply_patch.sh" ] && /bin/bash DOLIBARR_PACKAGES/apply_patch.sh
+
 
diff --git a/upgradeDolibarr.sh b/upgradeDolibarr.sh
index 6193901f5f3f660cc0e1c76c5cac4f739391fc4f..2cede64157742216f5c01e830f01a52ed05e363e 100644
--- a/upgradeDolibarr.sh
+++ b/upgradeDolibarr.sh
@@ -47,5 +47,6 @@ dpkg -i $package
 echo "Fixing dependencies"
 apt-get -f install
 rm /usr/share/dolibarr/documents/install.lock
+[ -f "DOLIBARR_PACKAGES/apply_patch.sh" ] && /bin/bash DOLIBARR_PACKAGES/apply_patch.sh
 echo "One final step is required to upgrade to Dolibarr $last_repo_version:"
 echo "Please go to your Dolibarr page and run the manual upgrade step"