Skip to content

Commit

Permalink
[FIX] resource_booking: Add booking_count to portal values only if re…
Browse files Browse the repository at this point in the history
…quested

The _prepare_home_portal_values() method sometimes requests booking_count
and only then should we return the value.
  • Loading branch information
victoralmau committed May 17, 2024
1 parent 1a21cda commit 3cdd3da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resource_booking/controllers/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ def _get_booking_sudo(self, booking_id, access_token):
def _prepare_home_portal_values(self, counters):
"""Compute values for multi-booking portal views."""
values = super()._prepare_home_portal_values(counters)
booking_count = request.env["resource.booking"].search_count([])
values.update({"booking_count": booking_count})
if "booking_count" in counters:
booking_count = request.env["resource.booking"].search_count([])
values.update({"booking_count": booking_count})
return values

def _booking_get_page_view_values(self, booking_sudo, access_token, **kwargs):
Expand Down

0 comments on commit 3cdd3da

Please sign in to comment.