From addd4ae73ca4fa7a7046a88dd1310361dd895f15 Mon Sep 17 00:00:00 2001
From: Swapnesh Shah <swapneshshah111@gmail.com>
Date: Wed, 25 Aug 2021 18:11:51 +0000
Subject: [PATCH] [FIX] gamification: use context_today instead of today

`fields.Date.today` doesn't give date based on TZ which might be wrong
in some cases as it doesn't respect TZ.

With this commit, we are using `fields.Date.context_today` as default date.

closes odoo/odoo#75600

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
---
 addons/gamification/models/goal.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/gamification/models/goal.py b/addons/gamification/models/goal.py
index 0e5d1be83a2d..51e2bc7aea7a 100644
--- a/addons/gamification/models/goal.py
+++ b/addons/gamification/models/goal.py
@@ -410,7 +410,7 @@ class Goal(models.Model):
         If the current value is changed and the report frequency is set to On
         change, a report is generated
         """
-        vals['last_update'] = fields.Date.today()
+        vals['last_update'] = fields.Date.context_today(self)
         result = super(Goal, self).write(vals)
         for goal in self:
             if goal.state != "draft" and ('definition_id' in vals or 'user_id' in vals):
-- 
GitLab