Skip to content

Commit

Permalink
[FIX] validation message on activity done button
Browse files Browse the repository at this point in the history
  • Loading branch information
jayraj-omnia committed Jan 9, 2025
1 parent 7ac6bd8 commit ecbc73a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions activity_validation/models/mail_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ecbc73a

Please sign in to comment.