[FIX] lunch: make sure that user has a last_lunch_location

We should have the frontend and backend in sync on the last_location
of the user

closes odoo/odoo#33608

Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
This commit is contained in:
RomainLibert
2019-05-23 15:27:17 +00:00
parent 4cbf5dc97b
commit 4ae4af623d
+3 -1
View File
@@ -93,7 +93,9 @@ class LunchController(http.Controller):
'currency': {'symbol': currency.symbol, 'position': currency.position},
})
user_location = user.last_lunch_location_id if user.last_lunch_location_id else request.env['lunch.location'].search([], limit=1)
if not user.last_lunch_location_id:
user.last_lunch_location_id = request.env['lunch.location'].search([], limit=1)
user_location = user.last_lunch_location_id
alert_domain = expression.AND([
[('available_today', '=', True)],