From aa1815438bc359163d803c68ac8629aa8aa81eeb Mon Sep 17 00:00:00 2001 From: "Jorge E. Gomez" Date: Wed, 28 Apr 2021 20:05:46 -0500 Subject: [PATCH] [ADD] Allows applying patches to installed modules --- README.md | 6 ++++++ apply_patches.sh | 21 +++++++++++++++++++ ...uth-oauth-multi-token_error-in-login.patch | 17 +++++++++++++++ 3 files changed, 44 insertions(+) create mode 100755 apply_patches.sh create mode 100644 patches/20210420_auth-oauth-multi-token_error-in-login.patch diff --git a/README.md b/README.md index d4bdeff..ac919db 100644 --- a/README.md +++ b/README.md @@ -71,3 +71,9 @@ git pull --recurse-submodules sudo ./install_all.sh ``` +### To apply patches to installed modules: + +```sh +sudo ./apply_patches.sh +``` + diff --git a/apply_patches.sh b/apply_patches.sh new file mode 100755 index 0000000..05afa81 --- /dev/null +++ b/apply_patches.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Installs selected content from the downloaded repos into a production folder +# + +if [ $UID != 0 ]; then + echo "You need administration privileges to run this script." + exit 1 +fi + +DESTDIR=/opt/odoo + +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" +echo " Patch OCA modules" +echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + +DEST=$DESTDIR/community/auth_oauth_multi_token/ +OPTIONS="--directory=$DEST --strip=1" + +patch $OPTIONS < patches/20210420_auth-oauth-multi-token_error-in-login.patch + diff --git a/patches/20210420_auth-oauth-multi-token_error-in-login.patch b/patches/20210420_auth-oauth-multi-token_error-in-login.patch new file mode 100644 index 0000000..00bebb2 --- /dev/null +++ b/patches/20210420_auth-oauth-multi-token_error-in-login.patch @@ -0,0 +1,17 @@ +diff -rupN auth_oauth_multi_token/models/res_users.py auth_oauth_multi_token.patch/models/res_users.py +--- auth_oauth_multi_token/models/res_users.py 2021-04-15 03:35:47.362795561 +0000 ++++ auth_oauth_multi_token.patch/models/res_users.py 2021-04-20 22:54:51.992899568 +0000 +@@ -69,10 +69,10 @@ class ResUsers(models.Model): + res.oauth_master_uuid = self._generate_oauth_master_uuid() + + @api.model +- def _check_credentials(self, password): ++ def _check_credentials(self, password, env): + """Override to check credentials against multi tokens.""" + try: +- return super()._check_credentials(password) ++ return super()._check_credentials(password, env) + except exceptions.AccessDenied: + res = self.multi_token_model.sudo().search( + [ +