From 8d94215afca72f5a509e2c728a1ff09f8a3fe50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 19 Sep 2021 00:10:16 +0200 Subject: [PATCH] Use ends_at for record name of period and use language format issue10740 review334971002 (grafted from d0501664206fdbabc93d2d32c17f87c890ab6b09) --HG-- branch : 6.0 --- attendance.py | 10 ++++++++-- tests/scenario_attendance.rst | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/attendance.py b/attendance.py index 46474b1316..abd12debf9 100644 --- a/attendance.py +++ b/attendance.py @@ -87,7 +87,10 @@ class Line(ModelSQL, ModelView): return at.date() def get_rec_name(self, name): - return '%s@%s' % (self.employee.rec_name, self.at) + pool = Pool() + Lang = pool.get('ir.lang') + lang = Lang.get() + return '%s@%s' % (self.employee.rec_name, lang.strftime(self.at)) @classmethod def create(cls, vlist): @@ -200,7 +203,10 @@ class Period(Workflow, ModelSQL, ModelView): return 'draft' def get_rec_name(self, name): - return str(self.date) + pool = Pool() + Lang = pool.get('ir.lang') + lang = Lang.get() + return lang.strftime(self.ends_at) @classmethod def get_last_period_date(cls, company): diff --git a/tests/scenario_attendance.rst b/tests/scenario_attendance.rst index 25df9e4d5d..a0af8c4927 100644 --- a/tests/scenario_attendance.rst +++ b/tests/scenario_attendance.rst @@ -46,6 +46,8 @@ Create an attendance record for the employee:: >>> attendance.date == now.date() True + >>> bool(attendance.rec_name) + True When creating a new attendance the type is automatically set:: @@ -65,6 +67,9 @@ Close the period:: >>> period.state 'closed' + >>> bool(period.rec_name) + True + You can't create attendances in closed periods:: >>> attendance = Attendance()