Metadata-Version: 2.1
Name: odoo-addon-contract_refund_on_stop
Version: 18.0.1.0.0.6
Requires-Python: >=3.10
Requires-Dist: odoo-addon-contract_line_successor==18.0.*
Requires-Dist: odoo-addon-contract_variable_qty_prorated==18.0.*
Requires-Dist: odoo==18.0.*
Summary: Contract Refund On Stop
Home-page: https://github.com/OCA/contract
License: AGPL-3
Author: ACSONE SA/NV,Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Description-Content-Type: text/x-rst

.. 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/18.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-18-0/contract-18-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=18.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:%2018.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/18.0/contract_refund_on_stop>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
