From 9dc262ac7f727a8851675f17e930035d7ad039ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20E=2E=20G=C3=B3mez?= Date: Thu, 9 Mar 2023 02:21:29 -0500 Subject: [PATCH] [FIX] Apply the patch instead of reverting it. Fix comment --- apply_patches.sh | 2 +- ...r-attachment_allow-portal-users-attachment-access.patch | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apply_patches.sh b/apply_patches.sh index f147e88..5e28692 100755 --- a/apply_patches.sh +++ b/apply_patches.sh @@ -30,7 +30,7 @@ pt_core () SRC=$PWD DEST=$DESTDIR/core/ - OPTIONS="-p1 --verbose -R" + OPTIONS="-p1 --verbose" pushd $DEST # Already applied: diff --git a/patches/20230309_ir-attachment_allow-portal-users-attachment-access.patch b/patches/20230309_ir-attachment_allow-portal-users-attachment-access.patch index 5d645f4..33c21b5 100644 --- a/patches/20230309_ir-attachment_allow-portal-users-attachment-access.patch +++ b/patches/20230309_ir-attachment_allow-portal-users-attachment-access.patch @@ -2,9 +2,12 @@ diff --git a/odoo/addons/base/models/ir_attachment.py b/odoo/addons/base/models/ index f1d8701a1..0f7926756 100644 --- a/odoo/addons/base/models/ir_attachment.py +++ b/odoo/addons/base/models/ir_attachment.py -@@ -418,7 +418,10 @@ class IrAttachment(models.Model): +@@ -416,9 +416,13 @@ class IrAttachment(models.Model): + """ Restricts the access to an ir.attachment, according to referred mode """ + if self.env.is_superuser(): return True - # Always require an internal user (aka, employee) to access to a attachment +- # Always require an internal user (aka, employee) to access to a attachment ++ # Either internal users or Portal users (for some models) have access to attachments if not (self.env.is_admin() or self.env.user.has_group('base.group_user')): - raise AccessError(_("Sorry, you are not allowed to access this document.")) + res_models = ['account.move', 'stock.picking',