From 84c22445bd4d31d9ea6aeff96e73bc6caa9258ff Mon Sep 17 00:00:00 2001 From: Boris Gallet Date: Wed, 27 Aug 2025 16:44:36 +0200 Subject: [PATCH] [FIX] studies_base: correct date field study_participant --- studies_base/models/study_participant.py | 14 ++++++++ .../views/study_participant_views.xml | 36 +++++++++---------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/studies_base/models/study_participant.py b/studies_base/models/study_participant.py index 718c701..a6cf8b5 100644 --- a/studies_base/models/study_participant.py +++ b/studies_base/models/study_participant.py @@ -34,3 +34,17 @@ class StudyParticipant(models.Model): updated = fields.Datetime("Date mise à jour") active = fields.Boolean("Actif", default=True) + + @api.depends("write_date") + def _compute_updated(self): + for record in self: + ## XXXb0g : the following two lines are to be removed when all records will have been updated during migration + # if record.updated: + # continue + record.updated = record.write_date + + @api.depends("create_date") + def _compute_created(self): + for record in self: + if not record.created: + record.created = record.create_date diff --git a/studies_base/views/study_participant_views.xml b/studies_base/views/study_participant_views.xml index b51f2b6..ff6811a 100644 --- a/studies_base/views/study_participant_views.xml +++ b/studies_base/views/study_participant_views.xml @@ -3,13 +3,13 @@ study.participant.tree - study.participant + study.participant - - - - - + + + + + @@ -17,7 +17,7 @@ study.participant.form - study.participant + study.participant
@@ -27,7 +27,7 @@
- +