[FIX] event_sale: compute sale_available using superuser

Indeed this field is notably based on tickets availability. Reading tickets
products is not necessarily granted to everyone. People reading events should
be able to know if the sale is available or not independently of their access
on product model. Let us therefore use a compute sudo.

Task 2188857
PR #44545

X-original-commit: cfabf12ef888a9dac48cbb19763740e2c65225d5
This commit is contained in:
Debauche Stéphane
2020-02-18 15:59:12 +00:00
committed by Thibault Delavallée
parent 3721f49d4e
commit 62257ed5f2
+1 -1
View File
@@ -65,7 +65,7 @@ class EventTicket(models.Model):
start_sale_date = fields.Date(string="Registration Start")
end_sale_date = fields.Date(string="Registration End")
is_expired = fields.Boolean(string='Is Expired', compute='_compute_is_expired')
sale_available = fields.Boolean(string='Is Available', compute='_compute_sale_available')
sale_available = fields.Boolean(string='Is Available', compute='_compute_sale_available', compute_sudo=True)
registration_ids = fields.One2many('event.registration', 'event_ticket_id', string='Registrations')
# seats
seats_reserved = fields.Integer(string='Reserved Seats', compute='_compute_seats', store=True)