From 7076449752fa31616d07f2ef86360243f19a9ff4 Mon Sep 17 00:00:00 2001 From: fw-bot Date: Tue, 6 Oct 2020 12:30:20 +0000 Subject: [PATCH] [FIX] portal: share a record without partner_id field The method _notify_get_groups is called to determine how a user should be notified based on the groups he belongs to. If a record is shared via portal but the model does not have a field named `partner_id`, the method was failing. With this patch, the presence of the field is checked first. No additional access_token is computed if the field is not present. Forward port of #59123 closes odoo/odoo#59310 X-original-commit: 6612c7ae766e996c57bda5c4c23132797f162f1e Signed-off-by: Martin Trigaux (mat) --- addons/portal/models/portal_mixin.py | 4 ++-- doc/cla/corporate/tecnativa.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/portal/models/portal_mixin.py b/addons/portal/models/portal_mixin.py index f3e86d80ccd..1ff8a2319a0 100644 --- a/addons/portal/models/portal_mixin.py +++ b/addons/portal/models/portal_mixin.py @@ -62,9 +62,9 @@ class PortalMixin(models.AbstractModel): def _notify_get_groups(self): access_token = self._portal_ensure_token() - customer = self['partner_id'] groups = super(PortalMixin, self)._notify_get_groups() - if access_token and customer: + if access_token and 'partner_id' in self._fields and self['partner_id']: + customer = self['partner_id'] additional_params = { 'access_token': self.access_token, } diff --git a/doc/cla/corporate/tecnativa.md b/doc/cla/corporate/tecnativa.md index 5249fe08571..8f3bd06dcc9 100644 --- a/doc/cla/corporate/tecnativa.md +++ b/doc/cla/corporate/tecnativa.md @@ -21,3 +21,5 @@ David Vidal david.vidal@tecnativa.com https://github.com/chienandalu Cristina Martín cristina.martin@tecnativa.com https://github.com/cristinamartinrod (up to 2019-04-30) Ernesto Tejeda ernesto.tejeda@tecnativa.com https://github.com/ernestotejeda Alexandre Díaz alexandre.diaz@tecnativa.com https://github.com/Tardo +Víctor Martínez victor.martinez@tecnativa.com https://github.com/victoralmau +João Marques joao.marques@tecnativa.com https://github.com/joao-p-marques