OdooWiki OCA HUB

Contract Refund On Stop

contract_refund_on_stop folder_open OCA/contract open_in_new
Uncategorised License: AGPL-3

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.

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

Lets users stop a contract line even after it has already been invoiced: when the stop date falls before the last invoiced date, a refund invoice is created automatically for the unused period and the line's last invoiced date is moved back to the stop date.

This module changes what happens when a contract line is stopped early, after it has already been billed.

  • A new company setting, "enable_contract_line_refund_on_stop", appears in the Contracts section of the general settings screen. It is off unless switched on, and it is stored per company.
  • When the setting is on and a user stops a contract line whose last invoiced date is later than the stop date, Odoo automatically creates a refund invoice (a customer credit note, or a vendor refund if the contract is a supplier one) covering the period from the stop date to the last invoiced date.
  • The refund line is named after that period, using the customer's language and date format, and its quantity is prorated: the module splits the refund period into billing periods and adds up the proportional part of the contract quantity for each one, so only the unused service time is credited.
  • The line's last invoiced date is then set back to the stop date, and the normal stop process continues as usual.
  • If the setting is off, or the line was never invoiced, or the stop date is on or after the last invoiced date, nothing extra happens and the stop behaves as before.

The module works on contract lines (contract.line) and relies on the prorating logic of the variable quantity module. It adds no new menus or screens of its own beyond the settings option.

Models and fields (3)
  • res.company · extends an existing modelenable_contract_line_refund_on_stop
  • contract.line · extends an existing model
  • res.config.settings · extends an existing modelenable_contract_line_refund_on_stop

Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 2 confirmed, 7 with no information of 9 versions.

terminal Installation and usage

OCA documentation · Odoo 19.0

To enable the refund behavior when stopping invoiced contract lines:

  • Go to Invoicing / Configuration / Settings.
  • In the Contracts section, enable the checkbox: Enable Contract Line Refund on Stop
  • Ensure the Enable Contract Line Refund on Stop option is enabled for your company.
  • Open any active contract line that has been invoiced.
  • Click Stop and choose a stop date earlier than the last invoiced period.
  • The system will:
  • Create a refund invoice covering the over-invoiced period.
  • Update the contract line to end on the chosen stop date.

No verified information in OCA: Installation.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.