changeset d0501664206f in modules/attendance:default
details: 
https://hg.tryton.org/modules/attendance?cmd=changeset&node=d0501664206f
description:
        Use ends_at for record name of period and use language format

        issue10740
        review334971002
diffstat:

 attendance.py                 |  10 ++++++++--
 tests/scenario_attendance.rst |   5 +++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diffs (49 lines):

diff -r 5c03ce3d85f5 -r d0501664206f attendance.py
--- a/attendance.py     Mon Sep 13 19:23:55 2021 +0200
+++ b/attendance.py     Sun Sep 19 00:10:16 2021 +0200
@@ -87,7 +87,10 @@
         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 @@
         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 -r 5c03ce3d85f5 -r d0501664206f tests/scenario_attendance.rst
--- a/tests/scenario_attendance.rst     Mon Sep 13 19:23:55 2021 +0200
+++ b/tests/scenario_attendance.rst     Sun Sep 19 00:10:16 2021 +0200
@@ -46,6 +46,8 @@
 
     >>> attendance.date == now.date()
     True
+    >>> bool(attendance.rec_name)
+    True
 
 When creating a new attendance the type is automatically set::
 
@@ -65,6 +67,9 @@
     >>> period.state
     'closed'
 
+    >>> bool(period.rec_name)
+    True
+
 You can't create attendances in closed periods::
 
     >>> attendance = Attendance()

Reply via email to