Skip to content

Commit

Permalink
[IMP] account_loan: add loan lines menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
matteonext committed Oct 2, 2023
1 parent a0e6e09 commit df92808
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions account_loan/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"wizard/account_loan_post_view.xml",
"views/account_loan_view.xml",
"views/account_move_view.xml",
"views/account_loan_lines_view.xml",
],
"installable": True,
"external_dependencies": {
Expand Down
21 changes: 21 additions & 0 deletions account_loan/model/account_loan_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ class AccountLoanLine(models.Model):
readonly=True,
ondelete="cascade",
)
company_id = fields.Many2one(
"res.company", readonly=True, related="loan_id.company_id"
)
partner_id = fields.Many2one(
"res.partner", readonly=True, related="loan_id.partner_id"
)
is_leasing = fields.Boolean(
related="loan_id.is_leasing",
readonly=True,
Expand All @@ -49,6 +55,21 @@ class AccountLoanLine(models.Model):
readonly=True,
related="loan_id.long_term_loan_account_id",
)
journal_id = fields.Many2one(
"account.journal",
readonly=True,
related="loan_id.journal_id",
)
short_term_loan_account_id = fields.Many2one(
"account.account",
readonly=True,
related="loan_id.short_term_loan_account_id",
)
interest_expenses_account_id = fields.Many2one(
"account.account",
readonly=True,
related="loan_id.interest_expenses_account_id",
)
currency_id = fields.Many2one(
"res.currency",
related="loan_id.currency_id",
Expand Down
61 changes: 61 additions & 0 deletions account_loan/views/account_loan_lines_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="account_loan_lines_view" model="ir.ui.view">
<field name="name">account.loan.lines.view</field>
<field name="model">account.loan.line</field>
<field name="arch" type="xml">
<tree create="0" import="0">
<field name="sequence" />
<field name="loan_id" />
<field name="date" />
<field name="rate" />
<field name="pending_principal_amount" />
<field name="payment_amount" />
<field name="principal_amount" />
<field name="interests_amount" />
<field name="long_term_pending_principal_amount" />
<field name="long_term_principal_amount" />
<field name="company_id" optional="hide" />
<field name="partner_id" optional="hide" />
<field name="journal_id" optional="hide" />
<field name="short_term_loan_account_id" optional="hide" />
<field name="long_term_loan_account_id" optional="hide" />
<field name="interest_expenses_account_id" optional="hide" />
</tree>
</field>
</record>

<record id="view_account_loan_lines_search" model="ir.ui.view">
<field name="name">Loan Items</field>
<field name="model">account.loan.line</field>
<field name="arch" type="xml">
<search>
<field name="loan_id" />
<field name="partner_id" />
<group expand='0' string='Group by...'>
<filter
string='Loan'
name="group_by_loan_id"
context="{'group_by': 'loan_id'}"
/>
</group>
</search>
</field>
</record>

<record id="account_loan_lines_action" model="ir.actions.act_window">
<field name="name">Loan Items</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.loan.line</field>
<field name="view_mode">tree,pivot,graph</field>
<field name="view_id" ref="account_loan_lines_view" />
<field name="context">{'search_default_group_by_loan_id': 1}</field>
</record>
<menuitem
id="account_loan_lines_menu"
parent="account.menu_finance_entries"
sequence="90"
name="Loan Lines"
action="account_loan_lines_action"
/>
</odoo>

0 comments on commit df92808

Please sign in to comment.