Browse Source

Aug 3 [UPDT] Updated 'invoice_multi_approval'

13.0
AjmalCybro 1 year ago
parent
commit
251eb47ad2
  1. 2
      invoice_multi_approval/__manifest__.py
  2. 5
      invoice_multi_approval/doc/RELEASE_NOTES.md
  3. 37
      invoice_multi_approval/models/account_move.py

2
invoice_multi_approval/__manifest__.py

@ -21,7 +21,7 @@
#############################################################################
{
'name': "Invoice Multi level Approval",
'version': '13.0.1.0.0',
'version': '13.0.1.0.1',
'summary': """This module add the multiple approval option for invoice,
bill,refund and credit notes.""",
'description': """This module add the multiple approval option for invoice,

5
invoice_multi_approval/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 13.0.1.0.0
##### ADD
- Initial commit
#### 02.08.2024
#### Version 13.0.1.0.1
##### UPDT
- Bug Fix-Fixed the issue where the feature did not work when duplicating a record.

37
invoice_multi_approval/models/account_move.py

@ -26,8 +26,10 @@ class AccountMove(models.Model):
_inherit = 'account.move'
approval_ids = fields.One2many('approval.line', 'move_id')
document_fully_approved = fields.Boolean(compute='_compute_document_fully_approved')
check_approve_ability = fields.Boolean(compute='_compute_check_approve_ability')
document_fully_approved = fields.Boolean(
compute='_compute_document_fully_approved')
check_approve_ability = fields.Boolean(
compute='_compute_check_approve_ability')
is_approved = fields.Boolean(compute='_compute_is_approved')
page_visibility = fields.Boolean(compute='_compute_page_visibility')
@ -39,6 +41,37 @@ class AccountMove(models.Model):
else:
self.page_visibility = False
@api.model_create_multi
def create(self, vals):
record = super().create(vals)
invoice_approval_id = self.env['invoice.approval'].search([])
record.approval_ids = None
if invoice_approval_id.approve_customer_invoice and record.type == 'out_invoice':
for user in invoice_approval_id.invoice_approver_ids:
vals = {
'approver_id': user.id
}
record.approval_ids |= record.approval_ids.new(vals)
elif invoice_approval_id.approve_vendor_bill and record.type == 'in_invoice':
for user in invoice_approval_id.bill_approver_ids:
vals = {
'approver_id': user.id
}
record.approval_ids |= record.approval_ids.new(vals)
elif invoice_approval_id.approve_customer_credit and record.type == 'out_refund':
for user in invoice_approval_id.cust_credit_approver_ids:
vals = {
'approver_id': user.id
}
record.approval_ids |= record.approval_ids.new(vals)
elif invoice_approval_id.approve_vendor_credit and record.type == 'in_refund':
for user in invoice_approval_id.vend_credit_approver_ids:
vals = {
'approver_id': user.id
}
record.approval_ids |= record.approval_ids.new(vals)
return record
@api.onchange('partner_id')
def _onchange_partner_id(self):
"""This is the onchange function of the partner which loads the

Loading…
Cancel
Save