Browse Source

Jul 18 [UPDT] Updated 'advanced_loan_management'

pull/331/head
AjmalCybro 9 months ago
parent
commit
c7fc3711ec
  1. 7
      advanced_loan_management/models/loan_request.py
  2. 1
      advanced_loan_management/models/loan_type.py
  3. 6
      advanced_loan_management/models/repayment_lines.py
  4. 1
      advanced_loan_management/security/loan_management_groups.xml
  5. 15
      advanced_loan_management/security/loan_management_security.xml
  6. 12
      advanced_loan_management/views/loan_request_views.xml
  7. 1
      advanced_loan_management/views/loan_type_views.xml
  8. 2
      advanced_loan_management/views/repayment_lines_views.xml
  9. 2
      advanced_loan_management/views/res_config_settings_views.xml

7
advanced_loan_management/models/loan_request.py

@ -89,10 +89,9 @@ class LoanRequest(models.Model):
"rejected reason") "rejected reason")
request = fields.Boolean(string="Request", request = fields.Boolean(string="Request",
help="For monitoring the record") help="For monitoring the record")
state = fields.Selection( state = fields.Selection(string='State',
string='State',
selection=[('draft', 'Draft'), ('confirmed', 'Confirmed'), selection=[('draft', 'Draft'), ('confirmed', 'Confirmed'),
('waiting for approval', 'Waiting For Approval'), ('waiting', 'Waiting For Approval'),
('approved', 'Approved'), ('disbursed', 'Disbursed'), ('approved', 'Approved'), ('disbursed', 'Disbursed'),
('rejected', 'Rejected'), ('closed', 'Closed')], ('rejected', 'Rejected'), ('closed', 'Closed')],
copy=False, tracking=True, default='draft', help="Loan request states") copy=False, tracking=True, default='draft', help="Loan request states")
@ -148,7 +147,7 @@ class LoanRequest(models.Model):
def action_request_for_loan(self): def action_request_for_loan(self):
"""Change the state to waiting for approval""" """Change the state to waiting for approval"""
if self.request: if self.request:
self.write({'state': "waiting for approval"}) self.write({'state': "waiting"})
else: else:
message_id = self.env['message.popup'].create( message_id = self.env['message.popup'].create(
{'message': _("Compute the repayments before requesting")}) {'message': _("Compute the repayments before requesting")})

1
advanced_loan_management/models/loan_type.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
################################################################################ ################################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.

6
advanced_loan_management/models/repayment_lines.py

@ -122,9 +122,9 @@ class RepaymentLine(models.Model):
], ],
}) })
if invoice: if invoice:
invoice.action_post()
self.invoice=True self.invoice=True
self.write({'state':'invoiced'}) self.write({'state':'invoiced'})
return { return {
'name': 'Invoice', 'name': 'Invoice',
'res_model': 'account.move', 'res_model': 'account.move',
@ -136,8 +136,10 @@ class RepaymentLine(models.Model):
def action_view_invoice(self): def action_view_invoice(self):
"""To view the invoices""" """To view the invoices"""
invoice = self.env['account.move'].search([ invoice = self.env['account.move'].search([
('payment_reference', '=', self.name,) ('payment_reference', '=', self.name)
]) ])
self.invoice = True
return { return {
'name': 'Invoice', 'name': 'Invoice',
'res_model': 'account.move', 'res_model': 'account.move',

1
advanced_loan_management/security/loan_management_groups.xml

@ -19,6 +19,5 @@
<field name="implied_ids" eval="[(4, ref('advanced_loan_management.loan_management_group_user'))]"/> <field name="implied_ids" eval="[(4, ref('advanced_loan_management.loan_management_group_user'))]"/>
<field name="category_id" ref="loan_management_groups"/> <field name="category_id" ref="loan_management_groups"/>
</record> </record>
</data> </data>
</odoo> </odoo>

15
advanced_loan_management/security/loan_management_security.xml

@ -29,6 +29,21 @@
<field name="global" eval="True"/> <field name="global" eval="True"/>
<field name="domain_force">[('company_id', 'in', company_ids)]</field> <field name="domain_force">[('company_id', 'in', company_ids)]</field>
</record> </record>
<!-- Manager Group Access Rule-->
<record id="loan_request_manager_rule" model="ir.rule">
<field name="name">Access All Loan Request Created</field>
<field ref="model_loan_request" name="model_id"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups"
eval="[(4, ref('advanced_loan_management.loan_management_group_manager'))]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="True"/>
<field name="active" eval="True"/>
</record>
<!-- User Group Access Rule--> <!-- User Group Access Rule-->
<record id="loan_request_user_rule" model="ir.rule"> <record id="loan_request_user_rule" model="ir.rule">
<field name="name">Access Only Loan Request Created By User</field> <field name="name">Access Only Loan Request Created By User</field>

12
advanced_loan_management/views/loan_request_views.xml

@ -35,7 +35,7 @@
<header> <header>
<div class="alert alert-info" role="alert" <div class="alert alert-info" role="alert"
style="height: 40px; margin-bottom:0px;" style="height: 40px; margin-bottom:0px;"
invisible="[('state', 'not in', 'waiting for approval')]" invisible="state != 'waiting'"
groups="advanced_loan_management.loan_management_group_user"> groups="advanced_loan_management.loan_management_group_user">
Waiting for approval from the manager Waiting for approval from the manager
</div> </div>
@ -55,11 +55,11 @@
string="Request" string="Request"
type="object"/> type="object"/>
<button name="action_loan_approved" class="oe_highlight" <button name="action_loan_approved" class="oe_highlight"
invisible="state != 'waiting for approval'" invisible="state != 'waiting'"
string="Approve" type="object" string="Approve" type="object"
groups="advanced_loan_management.loan_management_group_manager"/> groups="advanced_loan_management.loan_management_group_manager"/>
<button name="action_loan_rejected" class="oe_highlight" <button name="action_loan_rejected" class="oe_highlight"
invisible="state != 'waiting for approval'" invisible="state != 'waiting'"
string="Reject" type="object" string="Reject" type="object"
groups="advanced_loan_management.loan_management_group_manager"/> groups="advanced_loan_management.loan_management_group_manager"/>
<button name="action_disburse_loan" class="oe_highlight" <button name="action_disburse_loan" class="oe_highlight"
@ -115,13 +115,13 @@
decoration-danger="state == 'unpaid'" decoration-danger="state == 'unpaid'"
decoration-warning="state == 'invoiced'" decoration-warning="state == 'invoiced'"
decoration-success="state == 'paid'"/> decoration-success="state == 'paid'"/>
<field name="invoice" invisible="1"/> <field name="invoice" column_invisible="1"/>
<button invisible="(invoice == True) or (state != 'unpaid') or (parent.state != 'disbursed')" <button invisible="(invoice == True) or (state != 'unpaid') or (parent.state != 'disbursed')"
name="action_pay_emi" name="action_pay_emi"
class="oe_highlight" class="oe_highlight"
string="Pay" string="Pay"
type="object"/> type="object"/>
<button invisible="(invoice == False) or (parent.state != 'disbursed')" <button invisible="(invoice == False) or (parent.state != 'disbursed') or (state == 'paid')"
name="action_view_invoice" name="action_view_invoice"
class="oe_highlight" class="oe_highlight"
string="View" string="View"
@ -138,7 +138,7 @@
</group> </group>
</page> </page>
<page string="Loan rejection" <page string="Loan rejection"
invisible="state == 'rejected'"> invisible="state != 'rejected'">
<field name="reject_reason" readonly="1"/> <field name="reject_reason" readonly="1"/>
</page> </page>
<page string="Accounting" <page string="Accounting"

1
advanced_loan_management/views/loan_type_views.xml

@ -81,7 +81,6 @@
<field name="documents_ids" <field name="documents_ids"
widget="many2many_tags"/> widget="many2many_tags"/>
</group> </group>
<group> <group>
<field name="processing_fee"/> <field name="processing_fee"/>
<field name="interest_rate" widget="percentage"/> <field name="interest_rate" widget="percentage"/>

2
advanced_loan_management/views/repayment_lines_views.xml

@ -71,7 +71,7 @@
<field name="amount"/> <field name="amount"/>
<field name="interest_amount"/> <field name="interest_amount"/>
<field name="total_amount"/> <field name="total_amount"/>
<field name="invoice" invisible="1"/> <field name="invoice" column_invisible="1"/>
</group> </group>
<group> <group>
<field name="company_id"/> <field name="company_id"/>

2
advanced_loan_management/views/res_config_settings_views.xml

@ -23,7 +23,7 @@
<xpath expr="//form" <xpath expr="//form"
position="inside"> position="inside">
<app data-string="Loan Management" string="Loan" name="advanced_loan_management"> <app data-string="Loan Management" string="Loan" name="advanced_loan_management">
<field name="interest_product_id" invisible="1"/> <field name="interest_product_id" column_invisible="1"/>
<field name="interest_product_id" invisible="1"/> <field name="interest_product_id" invisible="1"/>
<block title="Loan Interest" name="fiscal_localization_setting_container" > <block title="Loan Interest" name="fiscal_localization_setting_container" >
<setting string="Loan Interest Details" company_dependent="1" help="Interest product and repayment details."> <setting string="Loan Interest Details" company_dependent="1" help="Interest product and repayment details.">

Loading…
Cancel
Save