summaryrefslogtreecommitdiff
path: root/addons/event/models
diff options
context:
space:
mode:
authorstd-odoo <std@odoo.com>2020-07-16 09:48:57 +0000
committerstd-odoo <std@odoo.com>2020-07-17 08:34:12 +0000
commit89a2423c219beba85e682c30570a7c1a3b4d7014 (patch)
treea7a7cbd2a8d405ab67913341a09e4181718814f9 /addons/event/models
parentce8cb11054585ba27119656cb6a5e1760f27a84e (diff)
[FIX] website_event: fix ACL issue during registration
Bug === Register to an event with a public user. Sometimes an ACL error will be raised. Technical ========= Before flushing the environment (after the creation of the event registration in the endpoint `registration_confirm`), the ORM will recompute all needed stored fields. As we didn't write on some of them (`date_closed`, `utm_campaign_id`, `utm_source_id`, `utm_medium_id`) they are in the list `Environment::all.tocompute`. So, the ORM will recompute the fields even if the state didn't change (this behavior can be verify in `BaseModel::recompute`). This is done after the "create" call of the event registration and so without the SUDO flag. Task-2299227 closes odoo/odoo#54624 X-original-commit: 38f37cd483b7907b20171e2c44e14e69e3e00596 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/event/models')
-rw-r--r--addons/event/models/event_registration.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/event/models/event_registration.py b/addons/event/models/event_registration.py
index a611d300bdf..d8dc794b6e4 100644
--- a/addons/event/models/event_registration.py
+++ b/addons/event/models/event_registration.py
@@ -86,8 +86,11 @@ class EventRegistration(models.Model):
@api.depends('state')
def _compute_date_closed(self):
for registration in self:
- if registration.state == 'done' and not registration.date_closed:
- registration.date_closed = fields.Datetime.now()
+ if not registration.date_closed:
+ if registration.state == 'done':
+ registration.date_closed = fields.Datetime.now()
+ else:
+ registration.date_closed = False
@api.constrains('event_id', 'state')
def _check_seats_limit(self):