diff --git a/account_loan/README.rst b/account_loan/README.rst
index 9299b0073..3ca935dd5 100644
--- a/account_loan/README.rst
+++ b/account_loan/README.rst
@@ -14,13 +14,13 @@ Account Loan management
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
- :target: https://github.com/OCA/account-financial-tools/tree/13.0/account_loan
+ :target: https://github.com/OCA/account-financial-tools/tree/14.0/account_loan
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_loan
+ :target: https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_loan
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/92/13.0
+ :target: https://runbot.odoo-community.org/runbot/92/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -71,7 +71,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -103,6 +103,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/account-financial-tools `_ project on GitHub.
+This module is part of the `OCA/account-financial-tools `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_loan/__manifest__.py b/account_loan/__manifest__.py
index 453bfa14e..b8929c2ce 100644
--- a/account_loan/__manifest__.py
+++ b/account_loan/__manifest__.py
@@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Account Loan management",
- "version": "13.0.1.1.0",
+ "version": "14.0.1.0.0",
"author": "Creu Blanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"license": "AGPL-3",
diff --git a/account_loan/i18n/account_loan.pot b/account_loan/i18n/account_loan.pot
index 3b22be62a..1e3d2d0e8 100644
--- a/account_loan/i18n/account_loan.pot
+++ b/account_loan/i18n/account_loan.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 13.0\n"
+"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -64,6 +64,11 @@ msgstr ""
msgid "Activity State"
msgstr ""
+#. module: account_loan
+#: model:ir.model.fields,field_description:account_loan.field_account_loan__activity_type_icon
+msgid "Activity Type Icon"
+msgstr ""
+
#. module: account_loan
#: code:addons/account_loan/wizard/account_loan_pay_amount.py:0
#, python-format
@@ -208,6 +213,7 @@ msgstr ""
#: model:ir.model.fields,field_description:account_loan.field_account_loan_line__display_name
#: model:ir.model.fields,field_description:account_loan.field_account_loan_pay_amount__display_name
#: model:ir.model.fields,field_description:account_loan.field_account_loan_post__display_name
+#: model:ir.model.fields,field_description:account_loan.field_account_move__display_name
msgid "Display Name"
msgstr ""
@@ -271,6 +277,11 @@ msgstr ""
msgid "Followers (Partners)"
msgstr ""
+#. module: account_loan
+#: model:ir.model.fields,help:account_loan.field_account_loan__activity_type_icon
+msgid "Font awesome icon e.g. fa-tasks"
+msgstr ""
+
#. module: account_loan
#: model:ir.ui.menu,name:account_loan.account_loan_generate_wizard_menu
msgid "Generate Loan Entries"
@@ -298,6 +309,7 @@ msgstr ""
#: model:ir.model.fields,field_description:account_loan.field_account_loan_line__id
#: model:ir.model.fields,field_description:account_loan.field_account_loan_pay_amount__id
#: model:ir.model.fields,field_description:account_loan.field_account_loan_post__id
+#: model:ir.model.fields,field_description:account_loan.field_account_move__id
msgid "ID"
msgstr ""
@@ -372,7 +384,7 @@ msgstr ""
#. module: account_loan
#: model:ir.model,name:account_loan.model_account_move
-msgid "Journal Entries"
+msgid "Journal Entry"
msgstr ""
#. module: account_loan
@@ -386,6 +398,7 @@ msgstr ""
#: model:ir.model.fields,field_description:account_loan.field_account_loan_line____last_update
#: model:ir.model.fields,field_description:account_loan.field_account_loan_pay_amount____last_update
#: model:ir.model.fields,field_description:account_loan.field_account_loan_post____last_update
+#: model:ir.model.fields,field_description:account_loan.field_account_move____last_update
msgid "Last Modified on"
msgstr ""
@@ -434,10 +447,12 @@ msgstr ""
#. module: account_loan
#: model:ir.model,name:account_loan.model_account_loan
+#: model:ir.model.fields,field_description:account_loan.field_account_bank_statement_line__loan_id
#: model:ir.model.fields,field_description:account_loan.field_account_loan_line__loan_id
#: model:ir.model.fields,field_description:account_loan.field_account_loan_pay_amount__loan_id
#: model:ir.model.fields,field_description:account_loan.field_account_loan_post__loan_id
#: model:ir.model.fields,field_description:account_loan.field_account_move__loan_id
+#: model:ir.model.fields,field_description:account_loan.field_account_payment__loan_id
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_form
msgid "Loan"
msgstr ""
@@ -448,7 +463,9 @@ msgid "Loan Amount"
msgstr ""
#. module: account_loan
+#: model:ir.model.fields,field_description:account_loan.field_account_bank_statement_line__loan_line_id
#: model:ir.model.fields,field_description:account_loan.field_account_move__loan_line_id
+#: model:ir.model.fields,field_description:account_loan.field_account_payment__loan_line_id
msgid "Loan Line"
msgstr ""
@@ -550,6 +567,11 @@ msgstr ""
msgid "Moves"
msgstr ""
+#. module: account_loan
+#: model:ir.model.fields,field_description:account_loan.field_account_loan__my_activity_date_deadline
+msgid "My Activity Deadline"
+msgstr ""
+
#. module: account_loan
#: model:ir.model.fields,field_description:account_loan.field_account_loan__name
#: model:ir.model.fields,field_description:account_loan.field_account_loan_line__name
diff --git a/account_loan/migrations/13.0.1.1.0/post-migration.py b/account_loan/migrations/13.0.1.1.0/post-migration.py
deleted file mode 100644
index 0854e860a..000000000
--- a/account_loan/migrations/13.0.1.1.0/post-migration.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2021 Creu Blanca - Alba Riera
-
-from openupgradelib import openupgrade
-
-
-@openupgrade.migrate()
-def migrate(env, version):
- openupgrade.logged_query(
- env.cr,
- """
- UPDATE account_move am
- SET loan_line_id = ai.loan_line_id,
- loan_id = ai.loan_id
- FROM account_invoice ai
- WHERE ai.id = am.old_invoice_id and ai.loan_id is not null""",
- )
diff --git a/account_loan/model/account_loan.py b/account_loan/model/account_loan.py
index 6917549db..fac4002ad 100644
--- a/account_loan/model/account_loan.py
+++ b/account_loan/model/account_loan.py
@@ -22,10 +22,7 @@ class AccountLoan(models.Model):
_inherit = ["mail.thread", "mail.activity.mixin"]
def _default_company(self):
- force_company = self._context.get("force_company")
- if not force_company:
- return self.env.user.company_id.id
- return force_company
+ return self.env.company
name = fields.Char(
copy=False,
@@ -61,7 +58,10 @@ class AccountLoan(models.Model):
default="draft",
)
line_ids = fields.One2many(
- "account.loan.line", readonly=True, inverse_name="loan_id", copy=False,
+ "account.loan.line",
+ readonly=True,
+ inverse_name="loan_id",
+ copy=False,
)
periods = fields.Integer(
required=True,
@@ -88,7 +88,7 @@ class AccountLoan(models.Model):
default=0.0,
digits=(8, 6),
help="Currently applied rate",
- track_visibility="always",
+ tracking=True,
)
rate_period = fields.Float(
compute="_compute_rate_period",
@@ -117,12 +117,20 @@ class AccountLoan(models.Model):
default="fixed-annuity",
)
fixed_amount = fields.Monetary(
- currency_field="currency_id", compute="_compute_fixed_amount",
+ currency_field="currency_id",
+ compute="_compute_fixed_amount",
)
fixed_loan_amount = fields.Monetary(
- currency_field="currency_id", readonly=True, copy=False, default=0,
+ currency_field="currency_id",
+ readonly=True,
+ copy=False,
+ default=0,
+ )
+ fixed_periods = fields.Integer(
+ readonly=True,
+ copy=False,
+ default=0,
)
- fixed_periods = fields.Integer(readonly=True, copy=False, default=0,)
loan_amount = fields.Monetary(
currency_field="currency_id",
required=True,
@@ -153,7 +161,9 @@ class AccountLoan(models.Model):
help="When checked, the first payment will be on start date",
)
currency_id = fields.Many2one(
- "res.currency", compute="_compute_currency", readonly=True,
+ "res.currency",
+ compute="_compute_currency",
+ readonly=True,
)
journal_type = fields.Char(compute="_compute_journal_type")
journal_id = fields.Many2one(
@@ -190,7 +200,9 @@ class AccountLoan(models.Model):
states={"draft": [("readonly", False)]},
)
is_leasing = fields.Boolean(
- default=False, readonly=True, states={"draft": [("readonly", False)]},
+ default=False,
+ readonly=True,
+ states={"draft": [("readonly", False)]},
)
leased_asset_account_id = fields.Many2one(
"account.account",
@@ -212,7 +224,8 @@ class AccountLoan(models.Model):
)
move_ids = fields.One2many("account.move", copy=False, inverse_name="loan_id")
pending_principal_amount = fields.Monetary(
- currency_field="currency_id", compute="_compute_total_amounts",
+ currency_field="currency_id",
+ compute="_compute_total_amounts",
)
payment_amount = fields.Monetary(
currency_field="currency_id",
@@ -438,7 +451,7 @@ class AccountLoan(models.Model):
self.ensure_one()
action = self.env.ref("account.action_move_out_invoice_type")
result = action.read()[0]
- result["domain"] = [("loan_id", "=", self.id), ("type", "=", "in_invoice")]
+ result["domain"] = [("loan_id", "=", self.id), ("move_type", "=", "in_invoice")]
return result
@api.model
diff --git a/account_loan/model/account_loan_line.py b/account_loan/model/account_loan_line.py
index 075340a30..9fde711fd 100644
--- a/account_loan/model/account_loan_line.py
+++ b/account_loan/model/account_loan_line.py
@@ -20,38 +20,44 @@ class AccountLoanLine(models.Model):
name = fields.Char(compute="_compute_name")
loan_id = fields.Many2one(
- "account.loan", required=True, readonly=True, ondelete="cascade",
+ "account.loan",
+ required=True,
+ readonly=True,
+ ondelete="cascade",
+ )
+ is_leasing = fields.Boolean(
+ related="loan_id.is_leasing",
+ readonly=True,
)
- is_leasing = fields.Boolean(related="loan_id.is_leasing", readonly=True,)
loan_type = fields.Selection(
- [
- ("fixed-annuity", "Fixed Annuity"),
- ("fixed-principal", "Fixed Principal"),
- ("interest", "Only interest"),
- ],
related="loan_id.loan_type",
readonly=True,
)
loan_state = fields.Selection(
- [
- ("draft", "Draft"),
- ("posted", "Posted"),
- ("cancelled", "Cancelled"),
- ("closed", "Closed"),
- ],
related="loan_id.state",
readonly=True,
store=True,
)
sequence = fields.Integer(required=True, readonly=True)
date = fields.Date(
- required=True, readonly=True, help="Date when the payment will be accounted",
+ required=True,
+ readonly=True,
+ help="Date when the payment will be accounted",
)
long_term_loan_account_id = fields.Many2one(
- "account.account", readony=True, related="loan_id.long_term_loan_account_id",
+ "account.account",
+ readonly=True,
+ related="loan_id.long_term_loan_account_id",
+ )
+ currency_id = fields.Many2one(
+ "res.currency",
+ related="loan_id.currency_id",
+ )
+ rate = fields.Float(
+ required=True,
+ readonly=True,
+ digits=(8, 6),
)
- currency_id = fields.Many2one("res.currency", related="loan_id.currency_id",)
- rate = fields.Float(required=True, readonly=True, digits=(8, 6),)
pending_principal_amount = fields.Monetary(
currency_field="currency_id",
readonly=True,
@@ -88,7 +94,10 @@ class AccountLoanLine(models.Model):
compute="_compute_amounts",
help="Pending amount of the loan after the payment",
)
- move_ids = fields.One2many("account.move", inverse_name="loan_line_id",)
+ move_ids = fields.One2many(
+ "account.move",
+ inverse_name="loan_line_id",
+ )
has_moves = fields.Boolean(compute="_compute_has_moves")
has_invoices = fields.Boolean(compute="_compute_has_invoices")
_sql_constraints = [
@@ -241,9 +250,7 @@ class AccountLoanLine(models.Model):
def move_line_vals(self):
vals = []
- partner = self.loan_id.partner_id.with_context(
- force_company=self.loan_id.company_id.id
- )
+ partner = self.loan_id.partner_id.with_company(self.loan_id.company_id)
vals.append(
{
"account_id": partner.property_account_payable_id.id,
@@ -287,7 +294,7 @@ class AccountLoanLine(models.Model):
return {
"loan_line_id": self.id,
"loan_id": self.loan_id.id,
- "type": "in_invoice",
+ "move_type": "in_invoice",
"partner_id": self.loan_id.partner_id.id,
"invoice_date": self.date,
"journal_id": self.loan_id.journal_id.id,
@@ -426,7 +433,10 @@ class AccountLoanLine(models.Model):
"default_loan_line_id": self.id,
"default_loan_id": self.loan_id.id,
}
- result["domain"] = [("loan_line_id", "=", self.id), ("type", "=", "in_invoice")]
+ result["domain"] = [
+ ("loan_line_id", "=", self.id),
+ ("move_type", "=", "in_invoice"),
+ ]
if len(self.move_ids) == 1:
res = self.env.ref("account.view_move_form", False)
result["views"] = [(res and res.id or False, "form")]
diff --git a/account_loan/model/account_move.py b/account_loan/model/account_move.py
index 1691397fc..ff8825f6f 100644
--- a/account_loan/model/account_move.py
+++ b/account_loan/model/account_move.py
@@ -8,10 +8,15 @@ class AccountMove(models.Model):
_inherit = "account.move"
loan_line_id = fields.Many2one(
- "account.loan.line", readonly=True, ondelete="restrict",
+ "account.loan.line",
+ readonly=True,
+ ondelete="restrict",
)
loan_id = fields.Many2one(
- "account.loan", readonly=True, store=True, ondelete="restrict",
+ "account.loan",
+ readonly=True,
+ store=True,
+ ondelete="restrict",
)
def post(self):
diff --git a/account_loan/security/ir.model.access.csv b/account_loan/security/ir.model.access.csv
index 6c36ece8e..8d5731635 100644
--- a/account_loan/security/ir.model.access.csv
+++ b/account_loan/security/ir.model.access.csv
@@ -3,3 +3,6 @@ access_account_loan,account.loan,model_account_loan,account.group_account_user,1
access_account_loan_manager,account.loan,model_account_loan,account.group_account_manager,1,1,1,1
access_account_loan_line,account.loan.line,model_account_loan_line,account.group_account_user,1,0,0,0
access_account_loan_line_manager,account.loan.line,model_account_loan_line,account.group_account_manager,1,1,1,1
+access_account_loan_generate_wizard,access_account_loan_generate_wizard,model_account_loan_generate_wizard,account.group_account_user,1,0,0,0
+access_account_loan_pay_amount,access_account_loan_pay_amount,model_account_loan_pay_amount,account.group_account_user,1,0,0,0
+access_account_loan_post,access_account_loan_post,model_account_loan_post,account.group_account_user,1,0,0,0
diff --git a/account_loan/static/description/index.html b/account_loan/static/description/index.html
index 604a55f20..b7047ed2f 100644
--- a/account_loan/static/description/index.html
+++ b/account_loan/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module extends the functionality of accounting to support loans.
It will create automatically moves or invoices for loans.
Moreover, you can check the pending amount to be paid and reduce the debt.
@@ -420,7 +420,7 @@ leases before a selected date
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -446,7 +446,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/account-financial-tools project on GitHub.
+
This module is part of the OCA/account-financial-tools project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_loan/views/account_loan_view.xml b/account_loan/views/account_loan_view.xml
index 8ff0758f4..9723798be 100644
--- a/account_loan/views/account_loan_view.xml
+++ b/account_loan/views/account_loan_view.xml
@@ -215,7 +215,10 @@
-
+
+ Loans
+ account.loan
+