[ADD] Three new OCA modules

This commit is contained in:
Jorge Enrique Gómez Gómez 2023-03-16 21:37:52 -05:00
commit 3b976e2f00
2 changed files with 11 additions and 4 deletions

View File

@ -33,9 +33,12 @@ pt_core ()
OPTIONS="-p1 --verbose" OPTIONS="-p1 --verbose"
pushd $DEST pushd $DEST
# Already applied:
#git apply $OPTIONS $SRC/patches/20210603_auth-oauth_redirects-to-root.patch #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/20220131_purchase-requisition_match-variant.patch
git apply $OPTIONS $SRC/patches/20230206_ir-attachment_allow-portal-users-attachment-access.patch git apply $OPTIONS $SRC/patches/20230309_ir-attachment_allow-portal-users-attachment-access.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: # 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/20220204_mail_re-enables-buttons-in-notifications.patch
popd popd

View File

@ -2,12 +2,16 @@ diff --git a/odoo/addons/base/models/ir_attachment.py b/odoo/addons/base/models/
index f1d8701a1..0f7926756 100644 index f1d8701a1..0f7926756 100644
--- a/odoo/addons/base/models/ir_attachment.py --- a/odoo/addons/base/models/ir_attachment.py
+++ b/odoo/addons/base/models/ir_attachment.py +++ b/odoo/addons/base/models/ir_attachment.py
@@ -417,7 +417,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 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')): 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.")) - raise AccessError(_("Sorry, you are not allowed to access this document."))
+ res_models = ['account.move', 'stock.picking'] + res_models = ['account.move', 'stock.picking',
+ 'stock.certificate', 'stock.delivery']
+ if not self.res_model or not self.res_id or self.res_model not in res_models: + if not self.res_model or not self.res_id or self.res_model not in res_models:
+ raise AccessError(_("Sorry, you are not allowed to access this document.")) + raise AccessError(_("Sorry, you are not allowed to access this document."))
+ self.env[self.res_model].browse(self.res_id).check_access_rule('read') + self.env[self.res_model].browse(self.res_id).check_access_rule('read')