From 05cfd49ad3d76710a74a3a283db7fc1c5f41384e Mon Sep 17 00:00:00 2001
From: blackbelts <74664702+eslamtalaat74@users.noreply.github.com>
Date: Tue, 16 Sep 2025 11:17:32 +0300
Subject: [PATCH] activity modifications 2
---
.../odex25_program_activity/models/program.py | 18 ++++++++++++++++++
.../odex25_program_activity/views/program.xml | 6 ++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/odex25_ensan/odex25_program_activity/models/program.py b/odex25_ensan/odex25_program_activity/models/program.py
index 0a9dfdfd2..596ab51d3 100644
--- a/odex25_ensan/odex25_program_activity/models/program.py
+++ b/odex25_ensan/odex25_program_activity/models/program.py
@@ -310,6 +310,21 @@ class PaProgramActivityRegistration(models.Model):
store=False
)
+ return_reason = fields.Text(string='Return Reason')
+
+
+
+ def action_return_to_draft(self):
+ # Open wizard to collect return reason - opens form view on 'empowerment.return.reason.wizard'
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': _('سبب الإرجاع'),
+ 'view_mode': 'form',
+ 'res_model': 'pa.return.reason.wizard',
+ 'target': 'new',
+ 'context': {'default_registration_id': self.id}
+ }
+
@api.depends('familye_id', 'familye_id.member_ids', 'familye_id.member_ids.relationn',
'familye_id.member_ids.relationn.relation_type')
@@ -416,8 +431,11 @@ class PaReturnReasonWizard(models.TransientModel):
# move back to draft or social_specialist depending on the context/state
if self.registration_id.state == 'operation_manager':
self.registration_id.state = 'social_specialist'
+ self.registration_id.return_reason = self.reason
else:
self.registration_id.state = 'draft'
+ self.registration_id.return_reason = self.reason
+
return {'type': 'ir.actions.act_window_close'}
class PaProgram(models.Model):
diff --git a/odex25_ensan/odex25_program_activity/views/program.xml b/odex25_ensan/odex25_program_activity/views/program.xml
index c490917c1..200cb7491 100644
--- a/odex25_ensan/odex25_program_activity/views/program.xml
+++ b/odex25_ensan/odex25_program_activity/views/program.xml
@@ -323,10 +323,11 @@
-
-
@@ -363,6 +364,7 @@
+