diff options
| author | fw-bot <otis@odoo.com> | 2020-10-06 12:30:20 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2020-10-06 15:25:02 +0000 |
| commit | f3cc47f49acec2e5e1a6fa8b56a8766fb614458d (patch) | |
| tree | 25203d09e5c96998a6dcc14ecb9bcab890509422 | |
| parent | 5f2cab5d94ffd605e161cde9636f0a2b3f26beb4 (diff) | |
[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#59304
X-original-commit: 6612c7ae766e996c57bda5c4c23132797f162f1e
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
| -rw-r--r-- | addons/portal/models/portal_mixin.py | 4 | ||||
| -rw-r--r-- | 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 |
