diff options
| author | Goffin Simon <sig@odoo.com> | 2020-03-18 08:37:10 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2020-03-30 14:34:55 +0000 |
| commit | e4be7ad7a6367f3274b5e983c7719f1ed5d6f2c7 (patch) | |
| tree | 6336f12a9ba9d82ca6a36d6d0692c6290653242b /addons/website_event/controllers | |
| parent | 1daf8eb12735db5c697e4a0868b43fe44f6b2f6a (diff) | |
[FIX] website_event: Ordering more tickets than available seats
Steps to reproduce the bug:
- Let's consider an event E with Maximum Attendees = 2 and Autoconfirm
- Create two kind of tickets Premium with Maximum available seats = 2 and Normal with Maximum available seats = 2
- Go to the website and register for E
- Take two tickets Premium and two tickets Normal
Bug:
Odoo gave the possibility to buy for tickets for E even if the Maximum Attendees was 2
and Odoo never autoconfirm these tickets.
opw:2214576
closes odoo/odoo#48567
X-original-commit: ff49afc6c71285cf90f720f2e97f8adedee7204b
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Diffstat (limited to 'addons/website_event/controllers')
| -rw-r--r-- | addons/website_event/controllers/main.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/website_event/controllers/main.py b/addons/website_event/controllers/main.py index 1823bffcb6f..5e6ffb16751 100644 --- a/addons/website_event/controllers/main.py +++ b/addons/website_event/controllers/main.py @@ -299,9 +299,16 @@ class WebsiteEventController(http.Controller): @http.route(['/event/<model("event.event"):event>/registration/new'], type='json', auth="public", methods=['POST'], website=True) def registration_new(self, event, **post): tickets = self._process_tickets_form(event, post) + availability_check = True + if event.seats_availability == 'limited': + ordered_seats = 0 + for ticket in tickets: + ordered_seats += ticket['quantity'] + if event.seats_available < ordered_seats: + availability_check = False if not tickets: return False - return request.env['ir.ui.view'].render_template("website_event.registration_attendee_details", {'tickets': tickets, 'event': event}) + return request.env['ir.ui.view'].render_template("website_event.registration_attendee_details", {'tickets': tickets, 'event': event, 'availability_check': availability_check}) def _process_attendees_form(self, event, form_details): """ Process data posted from the attendee details form. |
