From c7fc3711ecfa6451fdb05c4762f7d3918560f4ed Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Fri, 19 Jul 2024 11:14:07 +0530 Subject: [PATCH] Jul 18 [UPDT] Updated 'advanced_loan_management' --- advanced_loan_management/models/loan_request.py | 9 ++++----- advanced_loan_management/models/loan_type.py | 1 - .../models/repayment_lines.py | 10 ++++++---- .../security/loan_management_groups.xml | 1 - .../security/loan_management_security.xml | 17 ++++++++++++++++- .../views/loan_request_views.xml | 12 ++++++------ .../views/loan_type_views.xml | 1 - .../views/repayment_lines_views.xml | 2 +- .../views/res_config_settings_views.xml | 2 +- 9 files changed, 34 insertions(+), 21 deletions(-) diff --git a/advanced_loan_management/models/loan_request.py b/advanced_loan_management/models/loan_request.py index 9498f93c1..7e79485ae 100644 --- a/advanced_loan_management/models/loan_request.py +++ b/advanced_loan_management/models/loan_request.py @@ -89,10 +89,9 @@ class LoanRequest(models.Model): "rejected reason") request = fields.Boolean(string="Request", help="For monitoring the record") - state = fields.Selection( - string='State', - selection=[('draft', 'Draft'), ('confirmed', 'Confirmed'), - ('waiting for approval', 'Waiting For Approval'), + state = fields.Selection(string='State', +selection=[('draft', 'Draft'), ('confirmed', 'Confirmed'), + ('waiting', 'Waiting For Approval'), ('approved', 'Approved'), ('disbursed', 'Disbursed'), ('rejected', 'Rejected'), ('closed', 'Closed')], copy=False, tracking=True, default='draft', help="Loan request states") @@ -148,7 +147,7 @@ class LoanRequest(models.Model): def action_request_for_loan(self): """Change the state to waiting for approval""" if self.request: - self.write({'state': "waiting for approval"}) + self.write({'state': "waiting"}) else: message_id = self.env['message.popup'].create( {'message': _("Compute the repayments before requesting")}) diff --git a/advanced_loan_management/models/loan_type.py b/advanced_loan_management/models/loan_type.py index 66e74f2e5..0cc7436bb 100644 --- a/advanced_loan_management/models/loan_type.py +++ b/advanced_loan_management/models/loan_type.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- ################################################################################ # # Cybrosys Technologies Pvt. Ltd. diff --git a/advanced_loan_management/models/repayment_lines.py b/advanced_loan_management/models/repayment_lines.py index ac69e0c82..87572904c 100644 --- a/advanced_loan_management/models/repayment_lines.py +++ b/advanced_loan_management/models/repayment_lines.py @@ -122,9 +122,9 @@ class RepaymentLine(models.Model): ], }) if invoice: - self.invoice = True - self.write({'state': 'invoiced'}) - + invoice.action_post() + self.invoice=True + self.write({'state':'invoiced'}) return { 'name': 'Invoice', 'res_model': 'account.move', @@ -136,8 +136,10 @@ class RepaymentLine(models.Model): def action_view_invoice(self): """To view the invoices""" invoice = self.env['account.move'].search([ - ('payment_reference', '=', self.name,) + ('payment_reference', '=', self.name) ]) + self.invoice = True + return { 'name': 'Invoice', 'res_model': 'account.move', diff --git a/advanced_loan_management/security/loan_management_groups.xml b/advanced_loan_management/security/loan_management_groups.xml index a192e8536..19ba7eec9 100644 --- a/advanced_loan_management/security/loan_management_groups.xml +++ b/advanced_loan_management/security/loan_management_groups.xml @@ -19,6 +19,5 @@ - \ No newline at end of file diff --git a/advanced_loan_management/security/loan_management_security.xml b/advanced_loan_management/security/loan_management_security.xml index f78e01452..e0a389112 100644 --- a/advanced_loan_management/security/loan_management_security.xml +++ b/advanced_loan_management/security/loan_management_security.xml @@ -29,7 +29,22 @@ [('company_id', 'in', company_ids)] - + + + + Access All Loan Request Created + + [(1, '=', 1)] + + + + + + + + + Access Only Loan Request Created By User diff --git a/advanced_loan_management/views/loan_request_views.xml b/advanced_loan_management/views/loan_request_views.xml index f94c2f913..0df294983 100644 --- a/advanced_loan_management/views/loan_request_views.xml +++ b/advanced_loan_management/views/loan_request_views.xml @@ -35,7 +35,7 @@
@@ -55,11 +55,11 @@ string="Request" type="object"/>