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