[ADD]ADD notify for done task+add request in project invoice

This commit is contained in:
zainab8585 2024-10-10 13:35:01 +02:00
parent 8c17bc70cb
commit b047465438
1 changed files with 12 additions and 11 deletions

View File

@ -62,15 +62,16 @@ class ProjectTask(models.Model):
department_manager_users = self.env.ref('project_base.group_project_department_manager').users
# Combine both user sets
user_ids = manager_users | department_manager_users
self.env['mail.message'].create({
'message_type': "notification",
'body': _("Task %s is done for project %s and needs your action") % (self.name, self.project_id.project_no or ""),
'subject': _("Done Task"),
'partner_ids': [(6, 0, user_ids.mapped('partner_id').ids)],
'notification_ids': [(0, 0, {'res_partner_id': user.partner_id.id, 'notification_type': 'inbox'})
for user in user_ids if user_ids],
'model': self._name,
'res_id': self.id,
'author_id': self.env.user.partner_id and self.env.user.partner_id.id
})
if self.stage_id.is_closed:
self.env['mail.message'].create({
'message_type': "notification",
'body': _("Task %s is done for project %s and needs your action") % (self.name, self.project_id.project_no or ""),
'subject': _("Done Task"),
'partner_ids': [(6, 0, user_ids.mapped('partner_id').ids)],
'notification_ids': [(0, 0, {'res_partner_id': user.partner_id.id, 'notification_type': 'inbox'})
for user in user_ids if user_ids],
'model': self._name,
'res_id': self.id,
'author_id': self.env.user.partner_id and self.env.user.partner_id.id
})