commit
baa3ffe028
|
|
@ -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 |= invoice_id
|
||||||
# self.project_id.purchase_order_id.invoice_ids | = [4,invoice_id.id]
|
# self.project_id.purchase_order_id.invoice_ids | = [4,invoice_id.id]
|
||||||
self.state = 'done'
|
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['views'] = form_view
|
||||||
action['res_id'] = invoice_id.id
|
action['res_id'] = invoice_id.id
|
||||||
return action
|
return action
|
||||||
|
|
@ -208,18 +221,7 @@ class ProjectInvoice(models.Model):
|
||||||
raise ValidationError(_("You cannot Request Invoice for Project that is not in Open status!"))
|
raise ValidationError(_("You cannot Request Invoice for Project that is not in Open status!"))
|
||||||
self._set_qty_invoiced()
|
self._set_qty_invoiced()
|
||||||
self.state = 'request'
|
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):
|
def _set_qty_invoiced(self):
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,7 @@
|
||||||
<field name="actual_payment_date" />
|
<field name="actual_payment_date" />
|
||||||
<field name="to_invoice" invisible="1" />
|
<field name="to_invoice" invisible="1" />
|
||||||
<field name="invoice_type" />
|
<field name="invoice_type" />
|
||||||
|
<field name="payment_state" widget="badge" decoration-danger="payment_state == 'not_paid'" decoration-warning="payment_state in ('partial', 'in_payment')" decoration-success="payment_state in ('paid', 'reversed')" attrs="{'invisible': [('payment_state', 'in', ('invoicing_legacy'))]}"/>
|
||||||
<field name="state" />
|
<field name="state" />
|
||||||
<!-- <button name="action_confirm" type="object" icon="fa-check" attrs="{'invisible':[('state','not in',['draft'])]}" />
|
<!-- <button name="action_confirm" type="object" icon="fa-check" attrs="{'invisible':[('state','not in',['draft'])]}" />
|
||||||
<button name="action_get_invoice" type="object" string="Details" icon="fa-list" /> -->
|
<button name="action_get_invoice" type="object" string="Details" icon="fa-list" /> -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue