Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions account_payment_term_installment/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
================================
Account Payment Term Installment
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ffcbc0544f94542ee6719e9502f4089138a561681273b6e6aeecac37c099684d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
: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--payment-lightgray.png?logo=github
:target: https://github.com/OCA/account-payment/tree/16.0/account_payment_term_installment
:alt: OCA/account-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-payment-16-0/account-payment-16-0-account_payment_term_installment
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-payment&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds the ability to define a number of installments on a payment term. Whenever the installment count or the interval between installments is changed, the payment term lines are regenerated automatically as equal installments separated by the configured interval, with the last line set as the balance.

**Table of contents**

.. contents::
:local:

Usage
=====

#. Go to *Accounting > Configuration > Payment Terms*.
#. Open or create a payment term.
#. Set the **Number of Installments** field to the desired value.
#. Optionally adjust the **Days Between Installments** (default 30).
#. The terms list is regenerated as equal installments plus a final balance line.

.. warning::

Setting **Number of Installments** greater than 1 replaces the existing
payment term lines. Per-line customizations added by other modules
(e.g. ``account_payment_term_extension`` end-of-month/days-after fields,
``account_payment_term_discount`` discount fields,
``account_payment_term_partner_holiday`` holiday data) are not preserved
and must be reapplied after generation.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-payment/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-payment/issues/new?body=module:%20account_payment_term_installment%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Escodoo

Contributors
~~~~~~~~~~~~

* `Escodoo <https://www.escodoo.com.br>`_:

* Kaynnan Lemes <kaynnan.lemes@escodoo.com.br>
* Marcel Savegnago <marcel.savegnago@escodoo.com.br>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

.. |maintainer-kaynnan| image:: https://github.com/kaynnan.png?size=40px
:target: https://github.com/kaynnan
:alt: kaynnan

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-kaynnan|

This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/16.0/account_payment_term_installment>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions account_payment_term_installment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2026 Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
21 changes: 21 additions & 0 deletions account_payment_term_installment/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2026 Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account Payment Term Installment",
"summary": """
Generate payment term lines automatically from a desired number of
installments.""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Escodoo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-payment",
"category": "Accounting & Finance",
"depends": ["account"],
"data": [
"views/account_payment_term_view.xml",
],
"installable": True,
"application": False,
"maintainers": ["kaynnan"],
}
1 change: 1 addition & 0 deletions account_payment_term_installment/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_payment_term
65 changes: 65 additions & 0 deletions account_payment_term_installment/models/account_payment_term.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2026 Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import Command, _, api, fields, models
from odoo.exceptions import ValidationError


class AccountPaymentTerm(models.Model):
_inherit = "account.payment.term"

installment_count = fields.Integer(
string="Number of Installments",
default=1,
help="When set greater than 1, the payment term lines are regenerated"
" automatically as equal installments separated by the configured"
" interval in days. The last line is always the balance.",
)
installment_interval_days = fields.Integer(
string="Days Between Installments",
default=30,
help="Number of days added between each installment. The first"
" installment is due after this many days.",
)

@api.constrains("installment_count", "installment_interval_days")
def _check_installment_values(self):
for term in self:
if term.installment_count < 1:
raise ValidationError(_("Number of installments must be at least 1."))
if term.installment_interval_days < 0:
raise ValidationError(
_("Days between installments must be zero or positive.")
)

@api.onchange("installment_count", "installment_interval_days")
def _onchange_installment_count(self):
if self.installment_count and self.installment_count > 1:
self._generate_installment_lines()

def _generate_installment_lines(self):
self.ensure_one()
count = self.installment_count or 1
interval = self.installment_interval_days or 0
commands = [Command.clear()]
if count > 1:
percent = 100.0 / count
for i in range(1, count):
commands.append(
Command.create(
{
"value": "percent",
"value_amount": percent,
"days": interval * i,
}
)
)
commands.append(
Command.create(
{
"value": "balance",
"days": interval * count if count > 1 else 0,
}
)
)
self.line_ids = commands
4 changes: 4 additions & 0 deletions account_payment_term_installment/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Escodoo <https://www.escodoo.com.br>`_:

* Kaynnan Lemes <kaynnan.lemes@escodoo.com.br>
* Marcel Savegnago <marcel.savegnago@escodoo.com.br>
1 change: 1 addition & 0 deletions account_payment_term_installment/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds the ability to define a number of installments on a payment term. Whenever the installment count or the interval between installments is changed, the payment term lines are regenerated automatically as equal installments separated by the configured interval, with the last line set as the balance.
14 changes: 14 additions & 0 deletions account_payment_term_installment/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#. Go to *Accounting > Configuration > Payment Terms*.
#. Open or create a payment term.
#. Set the **Number of Installments** field to the desired value.
#. Optionally adjust the **Days Between Installments** (default 30).
#. The terms list is regenerated as equal installments plus a final balance line.

.. warning::

Setting **Number of Installments** greater than 1 replaces the existing
payment term lines. Per-line customizations added by other modules
(e.g. ``account_payment_term_extension`` end-of-month/days-after fields,
``account_payment_term_discount`` discount fields,
``account_payment_term_partner_holiday`` holiday data) are not preserved
and must be reapplied after generation.
Loading
Loading