Update project_invoice
This commit is contained in:
parent
9a3c3b8abc
commit
efd67df85d
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in New Issue