From efd67df85d910f28df777592617ee27704ca26c0 Mon Sep 17 00:00:00 2001 From: zainab2097 <149927291+zainab2097@users.noreply.github.com> Date: Wed, 4 Sep 2024 10:58:19 +0300 Subject: [PATCH 1/2] Update project_invoice --- .../project_base/models/project_invoice.py | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/odex25_project/project_base/models/project_invoice.py b/odex25_project/project_base/models/project_invoice.py index ab36044d3..14b4b5a44 100644 --- a/odex25_project/project_base/models/project_invoice.py +++ b/odex25_project/project_base/models/project_invoice.py @@ -137,6 +137,19 @@ class ProjectInvoice(models.Model): # self.project_id.purchase_order_id.invoice_ids |= invoice_id # self.project_id.purchase_order_id.invoice_ids | = [4,invoice_id.id] self.state = 'done' + user_ids = self.env.ref('account.group_account_manager').users + self.env['mail.message'].create({ + 'message_type': "notification", + 'body': _("Invoice request created for project %s and need your action") % self.project_id.project_no, + 'subject': _("Invoice Request "), + '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 + }) + action['views'] = form_view action['res_id'] = invoice_id.id return action @@ -208,18 +221,7 @@ class ProjectInvoice(models.Model): raise ValidationError(_("You cannot Request Invoice for Project that is not in Open status!")) self._set_qty_invoiced() self.state = 'request' - user_ids = self.env.ref('account.group_account_manager').users - self.env['mail.message'].create({ - 'message_type': "notification", - 'body': _("Invoice request created for project %s and need your action") % self.project_id.project_no, - 'subject': _("Invoice Request "), - '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 - }) + def _set_qty_invoiced(self): From 8ebca295e3fe3083dd7d45a634e472d65600830e Mon Sep 17 00:00:00 2001 From: zainab2097 <149927291+zainab2097@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:00:54 +0300 Subject: [PATCH 2/2] Update project_views.xml --- odex25_project/project_base/views/project_views.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/odex25_project/project_base/views/project_views.xml b/odex25_project/project_base/views/project_views.xml index 77d7a1eb7..bd9ef660c 100644 --- a/odex25_project/project_base/views/project_views.xml +++ b/odex25_project/project_base/views/project_views.xml @@ -210,6 +210,7 @@ +