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
150 changes: 150 additions & 0 deletions contract_refund_on_stop/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=======================
Contract Refund On Stop
=======================

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

.. |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/license-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%2Fcontract-lightgray.png?logo=github
:target: https://github.com/OCA/contract/tree/19.0/contract_refund_on_stop
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-19-0/contract-19-0-contract_refund_on_stop
: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/contract&target_branch=19.0
:alt: Try me on Runboat

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

This module allows stopping a contract line even after it has been
invoiced.

When the stop date is earlier than the last invoiced date, the system
will:

- Automatically create a refund invoice for the period between the stop
date and the last invoiced date.
- Adjust the ``last_date_invoiced`` of the contract line to match the
stop date.
- Proceed with the normal stop process.

To accurately compute the refund amount, the module depends on
**``contract_variable_qty_prorated``**, which provides the prorating
logic used to determine how much of the previously invoiced quantity
should be refunded based on the actual number of days covered by the
refund period.

Without this dependency, it would not be possible to proportionally
calculate the part of the invoiced quantity corresponding to unused
service time when a contract is stopped mid-period.

This ensures that users can gracefully handle early contract
terminations without manual refund management, while maintaining
accurate prorated invoicing and accounting consistency.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

In the standard behavior of the Contract module, it is not possible to
stop a contract line if its stop date is earlier than the last invoiced
date. This restriction prevents users from adjusting contracts that were
invoiced too far in advance.

In some business cases, however, a contract may need to be stopped
retroactively (e.g., customer cancellation, early termination, or
service interruption). In such cases, it is necessary to **automatically
create a refund** for the invoiced period that should no longer be
billed.

Configuration
=============

To enable the refund behavior when stopping invoiced contract lines:

1. Go to **Invoicing / Configuration / Settings**.

2. In the **Contracts** section, enable the checkbox:

**Enable Contract Line Refund on Stop**

Usage
=====

1. Ensure the **Enable Contract Line Refund on Stop** option is enabled
for your company.
2. Open any **active contract line** that has been invoiced.
3. Click **Stop** and choose a stop date earlier than the last invoiced
period.
4. The system will:

- Create a **refund invoice** covering the over-invoiced period.
- Update the contract line to end on the chosen stop date.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/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/contract/issues/new?body=module:%20contract_refund_on_stop%0Aversion:%2019.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
-------

* ACSONE SA/NV

Contributors
------------

- Souheil Bejaoui souheil.bejaoui@acsone.eu

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-sbejaoui| image:: https://github.com/sbejaoui.png?size=40px
:target: https://github.com/sbejaoui
:alt: sbejaoui

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

|maintainer-sbejaoui|

This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/19.0/contract_refund_on_stop>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions contract_refund_on_stop/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions contract_refund_on_stop/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Contract Refund On Stop",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/contract",
"depends": ["contract_line_successor", "contract_variable_qty_prorated"],
"data": ["views/res_config_settings.xml"],
"maintainers": ["sbejaoui"],
}
50 changes: 50 additions & 0 deletions contract_refund_on_stop/i18n/contract_refund_on_stop.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_refund_on_stop
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: contract_refund_on_stop
#: model:ir.model,name:contract_refund_on_stop.model_res_company
msgid "Companies"
msgstr ""

#. module: contract_refund_on_stop
#: model:ir.model,name:contract_refund_on_stop.model_res_config_settings
msgid "Config Settings"
msgstr ""

#. module: contract_refund_on_stop
#: model:ir.model,name:contract_refund_on_stop.model_contract_line
msgid "Contract Line"
msgstr ""

#. module: contract_refund_on_stop
#: model:ir.model.fields,field_description:contract_refund_on_stop.field_res_company__enable_contract_line_refund_on_stop
#: model:ir.model.fields,field_description:contract_refund_on_stop.field_res_config_settings__enable_contract_line_refund_on_stop
msgid "Enable Contract Line Refund On Stop"
msgstr ""

#. module: contract_refund_on_stop
#: model:ir.model.fields,help:contract_refund_on_stop.field_res_company__enable_contract_line_refund_on_stop
#: model:ir.model.fields,help:contract_refund_on_stop.field_res_config_settings__enable_contract_line_refund_on_stop
msgid ""
"If enabled, users can stop a contract line even after it has been invoiced. "
"A refund will automatically be created for the invoiced period beyond the "
"stop date."
msgstr ""

#. module: contract_refund_on_stop
#. odoo-python
#: code:addons/contract_refund_on_stop/models/contract_line.py:0
msgid "Refund for period %(to_refund_start_date)s %(to_refund_end_date)s"
msgstr ""
56 changes: 56 additions & 0 deletions contract_refund_on_stop/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_refund_on_stop
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-10-14 09:42+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"

#. module: contract_refund_on_stop
#: model:ir.model,name:contract_refund_on_stop.model_res_company
msgid "Companies"
msgstr "Aziende"

#. module: contract_refund_on_stop
#: model:ir.model,name:contract_refund_on_stop.model_res_config_settings
msgid "Config Settings"
msgstr "Impostazioni configurazione"

#. module: contract_refund_on_stop
#: model:ir.model,name:contract_refund_on_stop.model_contract_line
msgid "Contract Line"
msgstr "Riga contratto"

#. module: contract_refund_on_stop
#: model:ir.model.fields,field_description:contract_refund_on_stop.field_res_company__enable_contract_line_refund_on_stop
#: model:ir.model.fields,field_description:contract_refund_on_stop.field_res_config_settings__enable_contract_line_refund_on_stop
msgid "Enable Contract Line Refund On Stop"
msgstr "Abilita il rimborso riga contratto al termine"

#. module: contract_refund_on_stop
#: model:ir.model.fields,help:contract_refund_on_stop.field_res_company__enable_contract_line_refund_on_stop
#: model:ir.model.fields,help:contract_refund_on_stop.field_res_config_settings__enable_contract_line_refund_on_stop
msgid ""
"If enabled, users can stop a contract line even after it has been invoiced. "
"A refund will automatically be created for the invoiced period beyond the "
"stop date."
msgstr ""
"Se abilitata, gli utenti possono terminare una riga di contratto anche se è "
"già stata fatturata. Verrà creato automaticamente un rimborso per il periodo "
"fatturato oltre la data di termine."

#. module: contract_refund_on_stop
#. odoo-python
#: code:addons/contract_refund_on_stop/models/contract_line.py:0
msgid "Refund for period %(to_refund_start_date)s %(to_refund_end_date)s"
msgstr "Rimborso per il periodo %(to_refund_start_date)s %(to_refund_end_date)s"
57 changes: 57 additions & 0 deletions contract_refund_on_stop/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_refund_on_stop
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-12-29 17:44+0000\n"
"Last-Translator: Bosd <c5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>\n"
"Language-Team: none\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"

#. module: contract_refund_on_stop
#: model:ir.model,name:contract_refund_on_stop.model_res_company
msgid "Companies"
msgstr "Bedrijven"

#. module: contract_refund_on_stop
#: model:ir.model,name:contract_refund_on_stop.model_res_config_settings
msgid "Config Settings"
msgstr "Configuratie-instellingen"

#. module: contract_refund_on_stop
#: model:ir.model,name:contract_refund_on_stop.model_contract_line
msgid "Contract Line"
msgstr "Contractregel"

#. module: contract_refund_on_stop
#: model:ir.model.fields,field_description:contract_refund_on_stop.field_res_company__enable_contract_line_refund_on_stop
#: model:ir.model.fields,field_description:contract_refund_on_stop.field_res_config_settings__enable_contract_line_refund_on_stop
msgid "Enable Contract Line Refund On Stop"
msgstr "Creditering van contractregel bij stopzetten inschakelen"

#. module: contract_refund_on_stop
#: model:ir.model.fields,help:contract_refund_on_stop.field_res_company__enable_contract_line_refund_on_stop
#: model:ir.model.fields,help:contract_refund_on_stop.field_res_config_settings__enable_contract_line_refund_on_stop
msgid ""
"If enabled, users can stop a contract line even after it has been invoiced. "
"A refund will automatically be created for the invoiced period beyond the "
"stop date."
msgstr ""
"Indien ingeschakeld, kunnen gebruikers een contractregel stopzetten, zelfs "
"nadat deze is gefactureerd. Er wordt automatisch een creditnota aangemaakt "
"voor de gefactureerde periode na de stopdatum."

#. module: contract_refund_on_stop
#. odoo-python
#: code:addons/contract_refund_on_stop/models/contract_line.py:0
msgid "Refund for period %(to_refund_start_date)s %(to_refund_end_date)s"
msgstr ""
"Terugbetaling voor periode %(to_refund_start_date)s %(to_refund_end_date)s"
3 changes: 3 additions & 0 deletions contract_refund_on_stop/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import contract_line
from . import res_company
from . import res_config_settings
Loading
Loading