diff --git a/odex25_transactions/exp_transaction_documents/wizard/transaction_reply_wizard.py b/odex25_transactions/exp_transaction_documents/wizard/transaction_reply_wizard.py
index a96de05d8..8a056a1c5 100644
--- a/odex25_transactions/exp_transaction_documents/wizard/transaction_reply_wizard.py
+++ b/odex25_transactions/exp_transaction_documents/wizard/transaction_reply_wizard.py
@@ -30,16 +30,20 @@ class TransactionReturnWizard(models.TransientModel):
elif self.outgoing_transaction_id:
transaction = self.outgoing_transaction_id
name = 'outgoing_transaction_id'
+
transaction_trace_obj = self.env['cm.transaction.trace']
transaction_id = transaction_trace_obj.search(
[(name, '=', transaction.id), ('action', 'not in', ('archive', 'reopen'))],
order="create_date desc", limit=1)
+
if transaction_id:
transaction.forward_user_id = transaction_id.from_id.user_id.id
else:
transaction.forward_user_id = transaction.employee_id.user_id.id
+
transaction.state = 'reply'
- forward_entity = self.env['cm.entity'].search([('user_id', '=', transaction.forward_user_id.id)],limit=1)
+ forward_entity = self.env['cm.entity'].search([('user_id', '=', transaction.forward_user_id.id)], limit=1)
+
# Check if attachment_id and filename are not empty before creating attachment
if self.attachment_id and self.filename:
attachment = self.env['ir.attachment'].create({
@@ -51,11 +55,10 @@ class TransactionReturnWizard(models.TransientModel):
})
transaction.attachment_rule_ids.create({
'file_save': [(4, attachment.id)],
- # 'name': transaction.id,
'description': self.att_description,
'attachment_filename': self.filename,
})
-
+
transaction.trace_ids.create({
'action': 'reply',
'to_id': forward_entity.id,
@@ -65,8 +68,9 @@ class TransactionReturnWizard(models.TransientModel):
'cc_ids': [(6, 0, self.cc_ids.ids)],
name: transaction.id
})
+
employee = transaction.current_employee()
- subj = _('Message Has been replied !')
+ subj = _('Message Has been replied!')
msg = _(u'{} ← {}').format(employee and employee.name or '#',
transaction.forward_user_id.name)
msg = u'{}
{} {}.
{}'.format(msg,
@@ -80,6 +84,9 @@ class TransactionReturnWizard(models.TransientModel):
partner_ids.append(partner.secretary_id.user_id.partner_id.id)
elif partner.type == 'employee':
partner_ids.append(partner.user_id.partner_id.id)
+
transaction.action_send_notification(subj, msg, partner_ids)
+
if self.internal_transaction_id:
transaction.action_send_reply()
+