From ecbc73a3856f16b26b12eb638ac21a7db1442491 Mon Sep 17 00:00:00 2001 From: jayraj-omnia Date: Thu, 9 Jan 2025 15:20:54 +0530 Subject: [PATCH] [FIX] validation message on activity done button --- activity_validation/models/mail_activity.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/activity_validation/models/mail_activity.py b/activity_validation/models/mail_activity.py index 28ea4903..0fd86f71 100755 --- a/activity_validation/models/mail_activity.py +++ b/activity_validation/models/mail_activity.py @@ -249,13 +249,19 @@ def checkChildrenECODone(self, activity_id): raise UserError(_('You cannot move to Done because there are pending ECO activities.')) def checkChildrenECRDone(self, activity_id): - do_ecr = f"You cannot move to ECO or to Done because there are pending ECR activities for User:\n" - for child in activity_id.children_ids: - if child.plm_state not in ['done', 'cancel']: - do_ecr += f"\t-->\t{child.user_id.name}\n" - if do_ecr: - raise UserError(_(do_ecr)) + pending_ecr_users = [ + child.user_id.name + for child in activity_id.children_ids + if child.plm_state not in ['done', 'cancel'] + ] + if pending_ecr_users: + user_list = "\n".join(f"\t-->\t{user}" for user in pending_ecr_users) + message = ( + "You cannot move to ECO or to Done because there are pending ECR activities for User:\n" + f"{user_list}" + ) + raise UserError(_(message)) def action_to_eco(self): for activity_id in self: