[FIX]FIX issue in reply

This commit is contained in:
zainab8585 2024-10-02 14:17:03 +02:00
parent 4eef9217e2
commit f033fba071
1 changed files with 15 additions and 13 deletions

View File

@ -40,19 +40,21 @@ class TransactionReturnWizard(models.TransientModel):
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)
attachment = self.env['ir.attachment'].create({
'name': self.filename,
'datas': self.attachment_id,
'type': 'binary',
'res_model': 'cm.attachment.rule',
'res_id': transaction.id,
})
transaction.attachment_rule_ids.create({
'file_save': [(4, attachment.id)],
# 'name': transaction.id,
'description': self.att_description,
'attachment_filename': self.filename,
})
# 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({
'name': self.filename,
'datas': self.attachment_id,
'type': 'binary',
'res_model': 'cm.attachment.rule',
'res_id': transaction.id,
})
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',