2
0

[IMP] account_loan: add loan lines menu item

This commit is contained in:
matteo.tognini 2023-09-29 14:58:34 +02:00
parent c1f2276a4b
commit dc8f06cacb
5 changed files with 102 additions and 7 deletions

View File

@ -19,6 +19,7 @@
"views/account_loan_view.xml", "views/account_loan_view.xml",
"views/account_move_view.xml", "views/account_move_view.xml",
"views/res_partner.xml", "views/res_partner.xml",
"views/account_loan_lines_view.xml",
], ],
"installable": True, "installable": True,
"maintainers": ["etobella"], "maintainers": ["etobella"],

View File

@ -25,10 +25,31 @@ class AccountLoanLine(models.Model):
readonly=True, readonly=True,
ondelete="cascade", 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( is_leasing = fields.Boolean(
related="loan_id.is_leasing", related="loan_id.is_leasing",
readonly=True, readonly=True,
) )
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",
)
loan_type = fields.Selection( loan_type = fields.Selection(
related="loan_id.loan_type", related="loan_id.loan_type",
readonly=True, readonly=True,

View File

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Account Loan management</title> <title>Account Loan management</title>
<style type="text/css"> <style type="text/css">
/* /*
:Author: David Goodger (goodger@python.org) :Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $ :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain. :Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils. Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet. customize this style sheet.
*/ */
@ -403,7 +403,7 @@ Moreover, you can check the pending amount to be paid and reduce the debt.</p>
</ul> </ul>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1> <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>To use this module, you need to:</p> <p>To use this module, you need to:</p>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Go to <cite>Invoicing / Accounting &gt; Accounting &gt; Loans</cite></li> <li>Go to <cite>Invoicing / Accounting &gt; Accounting &gt; Loans</cite></li>

View File

@ -0,0 +1,65 @@
<?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" />
<groupby name="loan_id">
<button name="edit" type="edit" icon="fa-edit" title="Edit" />
</groupby>
</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="loan_menu"
sequence="20"
name="Loan Items"
action="account_loan_lines_action"
/>
</odoo>

View File

@ -255,10 +255,18 @@
<field name="name">Loans</field> <field name="name">Loans</field>
<field name="res_model">account.loan</field> <field name="res_model">account.loan</field>
</record> </record>
<menuitem
id="loan_menu"
name="Loans"
parent="account.menu_finance_entries"
sequence="75"
/>
<menuitem <menuitem
id="account_loan_menu" id="account_loan_menu"
parent="account.menu_finance_entries" parent="loan_menu"
sequence="80" sequence="10"
name="Loans" name="Loans"
action="account_loan_action" action="account_loan_action"
/> />