From 4ae4af623d33acd51fefbe8fc30b4e92797c357a Mon Sep 17 00:00:00 2001 From: RomainLibert Date: Thu, 23 May 2019 15:27:17 +0000 Subject: [PATCH] [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) --- addons/lunch/controllers/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/lunch/controllers/main.py b/addons/lunch/controllers/main.py index b6e362a8b17..2097f86659a 100644 --- a/addons/lunch/controllers/main.py +++ b/addons/lunch/controllers/main.py @@ -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)],