diff --git a/contract_termination/README.rst b/contract_termination/README.rst new file mode 100644 index 0000000000..01f30b1066 --- /dev/null +++ b/contract_termination/README.rst @@ -0,0 +1,143 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +==================== +Contract Termination +==================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bac235b49f4cf12018e6c640f74d0fce7d5fb3131e882ad72a4d040a8fc36d1f + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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_termination + :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_termination + :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| + +| The **Contract Termination** module extends the ``contract`` module, + allowing users to properly manage the termination of contracts. +| It provides functionality to terminate contracts with a reason, track + termination comments and dates, and prevent further modifications on + terminated contracts unless reactivated. + +Features +-------- + +- **Terminate Contracts** + + - Users with the appropriate rights can terminate active contracts. + - Capture a termination reason, comment, and termination date. + +- **Update or Cancel Termination** + + - Update termination details if needed. + - Cancel (reactivate) a terminated contract. + +- **Contract Form Enhancements** + + - Display an alert on terminated contracts with the reason and + comment. + - Hide or disable contract actions (e.g., Send) and fields on + terminated contracts. + - Set contract fields as read-only after termination. + +- **Permissions** + + - Only users with the group ``Contract: Can Terminate Contracts`` + can terminate or cancel termination of contracts. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +- **Define Termination Reasons** + + - Go to **Contracts > Configuration > Termination Reasons**. + - Create reasons for contract termination (e.g., Customer decision, + End of service). + +- **Assign Rights** + + - Assign the group ``Can terminate contracts`` to users who should + be allowed to terminate contracts. + +- **Optional** + + - Define whether a termination comment should be required per + reason. + +Usage +===== + +1. Open an active contract. +2. Click on the **Terminate Contract** button. +3. Provide the termination reason, comment, and date. +4. After termination: + + - The contract becomes read-only. + - An alert banner shows the termination details. + +5. If necessary, you can **Update Termination Details** or **Cancel + Contract Termination** to reactivate the contract. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Souheil Bejaoui souheil.bejaoui@acsone.eu (ACSONE SA/NV) + +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. + +This module is part of the `OCA/contract `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/contract_termination/__init__.py b/contract_termination/__init__.py new file mode 100644 index 0000000000..aee8895e7a --- /dev/null +++ b/contract_termination/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/contract_termination/__manifest__.py b/contract_termination/__manifest__.py new file mode 100644 index 0000000000..3a404fdffe --- /dev/null +++ b/contract_termination/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Contract Termination", + "summary": """contract_termination""", + "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"], + "data": [ + "security/groups.xml", + "security/ir.model.access.csv", + "security/contract_terminate_reason.xml", + "views/contract_contract.xml", + "views/contract_terminate_reason.xml", + "wizards/contract_contract_terminate.xml", + ], + "demo": [], +} diff --git a/contract_termination/i18n/contract_termination.pot b/contract_termination/i18n/contract_termination.pot new file mode 100644 index 0000000000..68d1251749 --- /dev/null +++ b/contract_termination/i18n/contract_termination.pot @@ -0,0 +1,178 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_termination +# +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_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Are you sure you want to re-activate this contract?" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Are you sure you want to terminate this contract?" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Cancel" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Cancel Contract Termination" +msgstr "" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__contract_id +msgid "Contract" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Contract Contract Terminate" +msgstr "" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_line +msgid "Contract Line" +msgstr "" + +#. module: contract_termination +#: model:ir.actions.act_window,name:contract_termination.contract_terminate_reason_act_window +#: model:ir.model,name:contract_termination.model_contract_terminate_reason +#: model:ir.ui.menu,name:contract_termination.contract_terminate_reason_menu +msgid "Contract Termination Reason" +msgstr "" + +#. module: contract_termination +#: model:res.groups,name:contract_termination.can_terminate_contract +msgid "Contract: Can Terminate Contracts" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_uid +msgid "Created by" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_date +msgid "Created on" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__display_name +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__display_name +msgid "Display Name" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__id +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__id +msgid "ID" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_date +msgid "Last Updated on" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__name +msgid "Name" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment_required +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__terminate_comment_required +msgid "Require a termination comment" +msgstr "" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Terminate Contract" +msgstr "" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract_terminate +msgid "Terminate Contract Wizard" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "Terminate lines with last date invoiced" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,help:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "" +"Terminate the contract lines with the last invoiced date if they cannot be " +"terminated with the date reported in the wizard." +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__is_terminated +msgid "Terminated" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_comment +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment +msgid "Termination Comment" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_date +msgid "Termination Date" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_reason_id +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_reason_id +msgid "Termination Reason" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "This contract was terminated for the reason" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Update Termination Details" +msgstr "" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +msgid "You are not allowed to terminate contracts." +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "on" +msgstr "" diff --git a/contract_termination/i18n/it.po b/contract_termination/i18n/it.po new file mode 100644 index 0000000000..68b34c76cd --- /dev/null +++ b/contract_termination/i18n/it.po @@ -0,0 +1,183 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_termination +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-06-24 09:25+0000\n" +"Last-Translator: mymage \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_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Are you sure you want to re-activate this contract?" +msgstr "Sei sicuro di voler riattivare questo contratto?" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Are you sure you want to terminate this contract?" +msgstr "Sei sicuro di voler terminare questo contratto?" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Cancel" +msgstr "Annulla" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Cancel Contract Termination" +msgstr "Annulla risoluzione del contratto" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__contract_id +msgid "Contract" +msgstr "Contratto" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Contract Contract Terminate" +msgstr "Termina contratto" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_line +msgid "Contract Line" +msgstr "Riga contratto" + +#. module: contract_termination +#: model:ir.actions.act_window,name:contract_termination.contract_terminate_reason_act_window +#: model:ir.model,name:contract_termination.model_contract_terminate_reason +#: model:ir.ui.menu,name:contract_termination.contract_terminate_reason_menu +msgid "Contract Termination Reason" +msgstr "Motivo di risoluzione del contratto" + +#. module: contract_termination +#: model:res.groups,name:contract_termination.can_terminate_contract +msgid "Contract: Can Terminate Contracts" +msgstr "Contratti: può risolvere contratti" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__display_name +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__id +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__id +msgid "ID" +msgstr "ID" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__name +msgid "Name" +msgstr "Nome" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment_required +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__terminate_comment_required +msgid "Require a termination comment" +msgstr "Richiede una nota di risoluzione contratto" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Terminate Contract" +msgstr "Risoluzione contratto" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract_terminate +msgid "Terminate Contract Wizard" +msgstr "Procedura guidata risoluzione contratto" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "Terminate lines with last date invoiced" +msgstr "Chiudere le righe con ultima data fatturata" + +#. module: contract_termination +#: model:ir.model.fields,help:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "" +"Terminate the contract lines with the last invoiced date if they cannot be " +"terminated with the date reported in the wizard." +msgstr "" +"Chiudere le righe del contratto con l'ultima data fatturata se non è " +"possibile chiuderle con la data indicata nella procedura guidata." + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__is_terminated +msgid "Terminated" +msgstr "Terminato" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_comment +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment +msgid "Termination Comment" +msgstr "Nota risoluzione" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_date +msgid "Termination Date" +msgstr "Data risoluzione" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_reason_id +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_reason_id +msgid "Termination Reason" +msgstr "Motivo risoluzione" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "This contract was terminated for the reason" +msgstr "Questo contratto è stato terminato per il motivo" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Update Termination Details" +msgstr "Aggiorna dettagli risoluzione" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +msgid "You are not allowed to terminate contracts." +msgstr "Non si è autorizzati a terminare i contratti." + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "on" +msgstr "su" diff --git a/contract_termination/i18n/pt_BR.po b/contract_termination/i18n/pt_BR.po new file mode 100644 index 0000000000..ab109cc73e --- /dev/null +++ b/contract_termination/i18n/pt_BR.po @@ -0,0 +1,179 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_termination +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: pt_BR\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" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Are you sure you want to re-activate this contract?" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Are you sure you want to terminate this contract?" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Cancel" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Cancel Contract Termination" +msgstr "" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__contract_id +msgid "Contract" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Contract Contract Terminate" +msgstr "" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_line +msgid "Contract Line" +msgstr "" + +#. module: contract_termination +#: model:ir.actions.act_window,name:contract_termination.contract_terminate_reason_act_window +#: model:ir.model,name:contract_termination.model_contract_terminate_reason +#: model:ir.ui.menu,name:contract_termination.contract_terminate_reason_menu +msgid "Contract Termination Reason" +msgstr "" + +#. module: contract_termination +#: model:res.groups,name:contract_termination.can_terminate_contract +msgid "Contract: Can Terminate Contracts" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_uid +msgid "Created by" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_date +msgid "Created on" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__display_name +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__display_name +msgid "Display Name" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__id +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__id +msgid "ID" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_date +msgid "Last Updated on" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__name +msgid "Name" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment_required +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__terminate_comment_required +msgid "Require a termination comment" +msgstr "" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Terminate Contract" +msgstr "" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract_terminate +msgid "Terminate Contract Wizard" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "Terminate lines with last date invoiced" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,help:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "" +"Terminate the contract lines with the last invoiced date if they cannot be " +"terminated with the date reported in the wizard." +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__is_terminated +msgid "Terminated" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_comment +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment +msgid "Termination Comment" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_date +msgid "Termination Date" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_reason_id +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_reason_id +msgid "Termination Reason" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "This contract was terminated for the reason" +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Update Termination Details" +msgstr "" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +msgid "You are not allowed to terminate contracts." +msgstr "" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "on" +msgstr "" diff --git a/contract_termination/i18n/sv.po b/contract_termination/i18n/sv.po new file mode 100644 index 0000000000..484064cf68 --- /dev/null +++ b/contract_termination/i18n/sv.po @@ -0,0 +1,183 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_termination +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-08-05 14:21+0000\n" +"Last-Translator: jakobkrabbe \n" +"Language-Team: none\n" +"Language: sv\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_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Are you sure you want to re-activate this contract?" +msgstr "Är du säker på att du vill återaktivera det här avtalet?" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Are you sure you want to terminate this contract?" +msgstr "Är du säker på att du vill avsluta det här kontraktet?" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Cancel" +msgstr "Avbryt" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Cancel Contract Termination" +msgstr "Annullera Uppsägning av avtal" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__contract_id +msgid "Contract" +msgstr "Kontrakt" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Contract Contract Terminate" +msgstr "Kontrakt Kontrakt Avsluta" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_line +msgid "Contract Line" +msgstr "Kontraktslinje" + +#. module: contract_termination +#: model:ir.actions.act_window,name:contract_termination.contract_terminate_reason_act_window +#: model:ir.model,name:contract_termination.model_contract_terminate_reason +#: model:ir.ui.menu,name:contract_termination.contract_terminate_reason_menu +msgid "Contract Termination Reason" +msgstr "Orsak till uppsägning av avtal" + +#. module: contract_termination +#: model:res.groups,name:contract_termination.can_terminate_contract +msgid "Contract: Can Terminate Contracts" +msgstr "Kontrakt: Kan säga upp kontrakt" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_uid +msgid "Created by" +msgstr "Skapad av" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_date +msgid "Created on" +msgstr "Skapad på" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__display_name +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__display_name +msgid "Display Name" +msgstr "Visningsnamn" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__id +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__id +msgid "ID" +msgstr "ID" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_uid +msgid "Last Updated by" +msgstr "Senast uppdaterad av" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_date +msgid "Last Updated on" +msgstr "Senast uppdaterad den" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__name +msgid "Name" +msgstr "Namn" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment_required +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__terminate_comment_required +msgid "Require a termination comment" +msgstr "Kräv en kommentar om uppsägning" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Terminate Contract" +msgstr "Uppsägning av avtal" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract_terminate +msgid "Terminate Contract Wizard" +msgstr "Uppsägningsguide för kontrakt" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "Terminate lines with last date invoiced" +msgstr "Avsluta rader med sista faktureringsdatum" + +#. module: contract_termination +#: model:ir.model.fields,help:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "" +"Terminate the contract lines with the last invoiced date if they cannot be " +"terminated with the date reported in the wizard." +msgstr "" +"Avsluta avtalsraderna med det senaste faktureringsdatumet om de inte kan " +"avslutas med det datum som rapporteras i guiden." + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__is_terminated +msgid "Terminated" +msgstr "Avslutad" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_comment +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment +msgid "Termination Comment" +msgstr "Uppsägning Kommentar" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_date +msgid "Termination Date" +msgstr "Uppsägningsdatum" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_reason_id +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_reason_id +msgid "Termination Reason" +msgstr "Orsak till uppsägning" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "This contract was terminated for the reason" +msgstr "Detta avtal sades upp av följande skäl" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Update Termination Details" +msgstr "Uppdatera detaljer om uppsägning" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +msgid "You are not allowed to terminate contracts." +msgstr "Du har inte rätt att säga upp avtal." + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "on" +msgstr "på" diff --git a/contract_termination/i18n/tr.po b/contract_termination/i18n/tr.po new file mode 100644 index 0000000000..dbaa288dc5 --- /dev/null +++ b/contract_termination/i18n/tr.po @@ -0,0 +1,183 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_termination +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-07-14 14:16+0000\n" +"Last-Translator: Betül Öğmen \n" +"Language-Team: none\n" +"Language: tr\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_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Are you sure you want to re-activate this contract?" +msgstr "Bu aboneliği yeniden etkinleştirmek istediğinizden emin misiniz?" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Are you sure you want to terminate this contract?" +msgstr "Bu aboneliği feshetmek istediğinizden emin misiniz?" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Cancel" +msgstr "İptal et" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Cancel Contract Termination" +msgstr "Abonelik Fesihini İptal Et" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__contract_id +msgid "Contract" +msgstr "Abonelik" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Contract Contract Terminate" +msgstr "Abonelik Sözleşmesi Fesih" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_line +msgid "Contract Line" +msgstr "Abonelik Satırı" + +#. module: contract_termination +#: model:ir.actions.act_window,name:contract_termination.contract_terminate_reason_act_window +#: model:ir.model,name:contract_termination.model_contract_terminate_reason +#: model:ir.ui.menu,name:contract_termination.contract_terminate_reason_menu +msgid "Contract Termination Reason" +msgstr "Abonelik Fesih Nedeni" + +#. module: contract_termination +#: model:res.groups,name:contract_termination.can_terminate_contract +msgid "Contract: Can Terminate Contracts" +msgstr "Abonelik: Sözleşmeleri Fesih Edebilir" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_uid +msgid "Created by" +msgstr "Oluşturan" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__create_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__create_date +msgid "Created on" +msgstr "Oluşturulma" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__display_name +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__display_name +msgid "Display Name" +msgstr "Görünen İsim" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__id +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__id +msgid "ID" +msgstr "" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_uid +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_uid +msgid "Last Updated by" +msgstr "Son güncelleyen" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__write_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__write_date +msgid "Last Updated on" +msgstr "Son güncelleme" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__name +msgid "Name" +msgstr "Adı" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment_required +#: model:ir.model.fields,field_description:contract_termination.field_contract_terminate_reason__terminate_comment_required +msgid "Require a termination comment" +msgstr "Bir sonlandırma yorumu gerektir" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_terminate_form_view +msgid "Terminate Contract" +msgstr "Aboneliği Fesih" + +#. module: contract_termination +#: model:ir.model,name:contract_termination.model_contract_contract_terminate +msgid "Terminate Contract Wizard" +msgstr "Aboneliği Sonlandırma Sihirbazı" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "Terminate lines with last date invoiced" +msgstr "Son fatura tarihiyle satırları feshet" + +#. module: contract_termination +#: model:ir.model.fields,help:contract_termination.field_contract_contract_terminate__terminate_with_last_date_invoiced +msgid "" +"Terminate the contract lines with the last invoiced date if they cannot be " +"terminated with the date reported in the wizard." +msgstr "" +"Sözleşme satırları sihirbazda bildirilen tarih ile sonlandırılamıyorsa son " +"fatura tarihi ile sonlandırın." + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__is_terminated +msgid "Terminated" +msgstr "Sonlandırılmış" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_comment +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_comment +msgid "Termination Comment" +msgstr "Sonlandırma Yorumu" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_date +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_date +msgid "Termination Date" +msgstr "Sonlandırma Tarihi" + +#. module: contract_termination +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract__terminate_reason_id +#: model:ir.model.fields,field_description:contract_termination.field_contract_contract_terminate__terminate_reason_id +msgid "Termination Reason" +msgstr "Sonlandırma Nedeni" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "This contract was terminated for the reason" +msgstr "Bu sözleşme nedenden dolayı feshedildi" + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "Update Termination Details" +msgstr "Fesih Ayrıntılarını Güncelleyin" + +#. module: contract_termination +#. odoo-python +#: code:addons/contract_termination/models/contract_contract.py:0 +msgid "You are not allowed to terminate contracts." +msgstr "Abonelikleri feshetmenize izin verilmez." + +#. module: contract_termination +#: model_terms:ir.ui.view,arch_db:contract_termination.contract_contract_form_view +msgid "on" +msgstr "açık" diff --git a/contract_termination/models/__init__.py b/contract_termination/models/__init__.py new file mode 100644 index 0000000000..bffd8ec890 --- /dev/null +++ b/contract_termination/models/__init__.py @@ -0,0 +1,3 @@ +from . import contract_contract +from . import contract_terminate_reason +from . import contract_line diff --git a/contract_termination/models/contract_contract.py b/contract_termination/models/contract_contract.py new file mode 100644 index 0000000000..6312a10e15 --- /dev/null +++ b/contract_termination/models/contract_contract.py @@ -0,0 +1,80 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models +from odoo.exceptions import UserError + + +class ContractContract(models.Model): + _inherit = "contract.contract" + + is_terminated = fields.Boolean(string="Terminated", readonly=True, copy=False) + terminate_reason_id = fields.Many2one( + comodel_name="contract.terminate.reason", + string="Termination Reason", + ondelete="restrict", + readonly=True, + copy=False, + tracking=True, + ) + terminate_comment = fields.Text( + string="Termination Comment", + readonly=True, + copy=False, + tracking=True, + ) + terminate_date = fields.Date( + string="Termination Date", + readonly=True, + copy=False, + tracking=True, + ) + + def action_terminate_contract(self): + self.ensure_one() + context = {"default_contract_id": self.id} + return { + "type": "ir.actions.act_window", + "name": self.env._("Terminate Contract"), + "res_model": "contract.contract.terminate", + "view_mode": "form", + "target": "new", + "context": context, + } + + def action_cancel_contract_termination(self): + self.ensure_one() + self.write( + { + "is_terminated": False, + "terminate_reason_id": False, + "terminate_comment": False, + "terminate_date": False, + } + ) + + def _terminate_contract( + self, + terminate_reason_id, + terminate_comment, + terminate_date, + terminate_lines_with_last_date_invoiced=False, + ): + self.ensure_one() + if not self.env.user.has_group("contract_termination.can_terminate_contract"): + raise UserError(self.env._("You are not allowed to terminate contracts.")) + for line in self.contract_line_ids.filtered("is_stop_allowed"): + line.stop( + max(terminate_date, line.last_date_invoiced) + if terminate_lines_with_last_date_invoiced and line.last_date_invoiced + else terminate_date + ) + self.write( + { + "is_terminated": True, + "terminate_reason_id": terminate_reason_id.id, + "terminate_comment": terminate_comment, + "terminate_date": terminate_date, + } + ) + return True diff --git a/contract_termination/models/contract_line.py b/contract_termination/models/contract_line.py new file mode 100644 index 0000000000..6b93758eec --- /dev/null +++ b/contract_termination/models/contract_line.py @@ -0,0 +1,32 @@ +# Copyright 2025 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class ContractLine(models.Model): + _inherit = "contract.line" + + @api.depends("contract_id.is_terminated") + def _compute_allowed(self): + for rec in self: + rec.update( + { + "is_plan_successor_allowed": False, + "is_stop_plan_successor_allowed": False, + "is_stop_allowed": False, + "is_cancel_allowed": False, + "is_un_cancel_allowed": False, + } + ) + if rec.contract_id.is_terminated: + continue + else: + super(ContractLine, rec)._compute_allowed() + return True + + @api.model + def _contract_line_to_renew_domain(self): + return [ + ("contract_id.is_terminated", "=", False), + ] + super()._contract_line_to_renew_domain() diff --git a/contract_termination/models/contract_terminate_reason.py b/contract_termination/models/contract_terminate_reason.py new file mode 100644 index 0000000000..48215a41d3 --- /dev/null +++ b/contract_termination/models/contract_terminate_reason.py @@ -0,0 +1,14 @@ +# Copyright 2020 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ContractTerminateReason(models.Model): + _name = "contract.terminate.reason" + _description = "Contract Termination Reason" + + name = fields.Char(required=True) + terminate_comment_required = fields.Boolean( + string="Require a termination comment", default=True + ) diff --git a/contract_termination/pyproject.toml b/contract_termination/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/contract_termination/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/contract_termination/readme/CONFIGURE.md b/contract_termination/readme/CONFIGURE.md new file mode 100644 index 0000000000..0c4f38bcf6 --- /dev/null +++ b/contract_termination/readme/CONFIGURE.md @@ -0,0 +1,9 @@ +- **Define Termination Reasons** + - Go to **Contracts > Configuration > Termination Reasons**. + - Create reasons for contract termination (e.g., Customer decision, End of service). + +- **Assign Rights** + - Assign the group `Can terminate contracts` to users who should be allowed to terminate contracts. + +- **Optional** + - Define whether a termination comment should be required per reason. \ No newline at end of file diff --git a/contract_termination/readme/CONTRIBUTORS.md b/contract_termination/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..ac775f4d05 --- /dev/null +++ b/contract_termination/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Souheil Bejaoui (ACSONE SA/NV) diff --git a/contract_termination/readme/DESCRIPTION.md b/contract_termination/readme/DESCRIPTION.md new file mode 100644 index 0000000000..85d84f3fde --- /dev/null +++ b/contract_termination/readme/DESCRIPTION.md @@ -0,0 +1,24 @@ +The **Contract Termination** module extends the `contract` module, allowing +users to properly manage the termination of contracts. +It provides functionality to terminate contracts with a reason, track +termination comments and dates, and prevent further modifications on terminated +contracts unless reactivated. + +## Features + +- **Terminate Contracts** + - Users with the appropriate rights can terminate active contracts. + - Capture a termination reason, comment, and termination date. + +- **Update or Cancel Termination** + - Update termination details if needed. + - Cancel (reactivate) a terminated contract. + +- **Contract Form Enhancements** + - Display an alert on terminated contracts with the reason and comment. + - Hide or disable contract actions (e.g., Send) and fields on terminated contracts. + - Set contract fields as read-only after termination. + +- **Permissions** + - Only users with the group `Contract: Can Terminate Contracts` can terminate + or cancel termination of contracts. diff --git a/contract_termination/readme/USAGE.md b/contract_termination/readme/USAGE.md new file mode 100644 index 0000000000..63fb74493b --- /dev/null +++ b/contract_termination/readme/USAGE.md @@ -0,0 +1,7 @@ +1. Open an active contract. +2. Click on the **Terminate Contract** button. +3. Provide the termination reason, comment, and date. +4. After termination: + - The contract becomes read-only. + - An alert banner shows the termination details. +5. If necessary, you can **Update Termination Details** or **Cancel Contract Termination** to reactivate the contract. diff --git a/contract_termination/security/contract_terminate_reason.xml b/contract_termination/security/contract_terminate_reason.xml new file mode 100644 index 0000000000..5da45af92d --- /dev/null +++ b/contract_termination/security/contract_terminate_reason.xml @@ -0,0 +1,23 @@ + + + + + contract.terminate.reason access manager + + + + + + + + + contract.terminate.reason access user + + + + + + + + diff --git a/contract_termination/security/groups.xml b/contract_termination/security/groups.xml new file mode 100644 index 0000000000..43accf7723 --- /dev/null +++ b/contract_termination/security/groups.xml @@ -0,0 +1,12 @@ + + + + + Contract: Can Terminate Contracts + + + diff --git a/contract_termination/security/ir.model.access.csv b/contract_termination/security/ir.model.access.csv new file mode 100644 index 0000000000..b252f95fa4 --- /dev/null +++ b/contract_termination/security/ir.model.access.csv @@ -0,0 +1,2 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"contract_contract_terminate_wizard","contract_contract_terminate_wizard","model_contract_contract_terminate","contract_termination.can_terminate_contract",1,1,1,1 diff --git a/contract_termination/static/description/icon.png b/contract_termination/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/contract_termination/static/description/icon.png differ diff --git a/contract_termination/static/description/index.html b/contract_termination/static/description/index.html new file mode 100644 index 0000000000..a2cf201633 --- /dev/null +++ b/contract_termination/static/description/index.html @@ -0,0 +1,496 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Contract Termination

+ +

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runboat

+
+
The Contract Termination module extends the contract module, +allowing users to properly manage the termination of contracts.
+
It provides functionality to terminate contracts with a reason, track +termination comments and dates, and prevent further modifications on +terminated contracts unless reactivated.
+
+
+

Features

+
    +
  • Terminate Contracts
      +
    • Users with the appropriate rights can terminate active contracts.
    • +
    • Capture a termination reason, comment, and termination date.
    • +
    +
  • +
  • Update or Cancel Termination
      +
    • Update termination details if needed.
    • +
    • Cancel (reactivate) a terminated contract.
    • +
    +
  • +
  • Contract Form Enhancements
      +
    • Display an alert on terminated contracts with the reason and +comment.
    • +
    • Hide or disable contract actions (e.g., Send) and fields on +terminated contracts.
    • +
    • Set contract fields as read-only after termination.
    • +
    +
  • +
  • Permissions
      +
    • Only users with the group Contract: Can Terminate Contracts +can terminate or cancel termination of contracts.
    • +
    +
  • +
+

Table of contents

+ +
+

Configuration

+
    +
  • Define Termination Reasons
      +
    • Go to Contracts > Configuration > Termination Reasons.
    • +
    • Create reasons for contract termination (e.g., Customer decision, +End of service).
    • +
    +
  • +
  • Assign Rights
      +
    • Assign the group Can terminate contracts to users who should +be allowed to terminate contracts.
    • +
    +
  • +
  • Optional
      +
    • Define whether a termination comment should be required per +reason.
    • +
    +
  • +
+
+
+

Usage

+
    +
  1. Open an active contract.
  2. +
  3. Click on the Terminate Contract button.
  4. +
  5. Provide the termination reason, comment, and date.
  6. +
  7. After termination:
      +
    • The contract becomes read-only.
    • +
    • An alert banner shows the termination details.
    • +
    +
  8. +
  9. If necessary, you can Update Termination Details or Cancel +Contract Termination to reactivate the contract.
  10. +
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+ +
+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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/contract project on GitHub.

+

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

+
+
+
+ + diff --git a/contract_termination/tests/__init__.py b/contract_termination/tests/__init__.py new file mode 100644 index 0000000000..3c02082d69 --- /dev/null +++ b/contract_termination/tests/__init__.py @@ -0,0 +1 @@ +from . import test_contract diff --git a/contract_termination/tests/test_contract.py b/contract_termination/tests/test_contract.py new file mode 100644 index 0000000000..373f14aa86 --- /dev/null +++ b/contract_termination/tests/test_contract.py @@ -0,0 +1,93 @@ +# Copyright 2018 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo.exceptions import UserError, ValidationError + +from odoo.addons.contract_line_successor.tests.test_contract import ( + TestContractSuccessor, + to_date, +) + + +class TestContractTermination(TestContractSuccessor): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.terminate_reason = cls.env["contract.terminate.reason"].create( + {"name": "terminate_reason"} + ) + + def test_action_terminate_contract(self): + action = self.contract.action_terminate_contract() + wizard = ( + self.env[action["res_model"]] + .with_context(**action["context"]) + .create( + { + "terminate_date": "2018-03-01", + "terminate_reason_id": self.terminate_reason.id, + "terminate_comment": "terminate_comment", + } + ) + ) + self.assertEqual(wizard.contract_id, self.contract) + with self.assertRaises(UserError): + wizard.terminate_contract() + group_can_terminate_contract = self.env.ref( + "contract_termination.can_terminate_contract" + ) + group_can_terminate_contract.user_ids |= self.env.user + wizard.terminate_contract() + self.assertTrue(self.contract.is_terminated) + self.assertEqual(self.contract.terminate_date, to_date("2018-03-01")) + self.assertEqual(self.contract.terminate_reason_id.id, self.terminate_reason.id) + self.assertEqual(self.contract.terminate_comment, "terminate_comment") + self.contract.action_cancel_contract_termination() + self.assertFalse(self.contract.is_terminated) + self.assertFalse(self.contract.terminate_reason_id) + self.assertFalse(self.contract.terminate_comment) + + def test_terminate_date_before_last_date_invoiced(self): + self.contract.journal_id.create( + { + "name": "Test Sales Journal", + "code": "TEST", + "type": "sale", + } + ) + self.contract.recurring_create_invoice() + self.assertEqual(self.acct_line.last_date_invoiced, to_date("2018-02-14")) + group_can_terminate_contract = self.env.ref( + "contract_termination.can_terminate_contract" + ) + group_can_terminate_contract.user_ids |= self.env.user + with self.assertRaises(ValidationError): + self.contract._terminate_contract( + self.terminate_reason, + "terminate_comment", + to_date("2018-02-13"), + ) + # Try terminate contract line with last_date_invoiced allowed + self.contract._terminate_contract( + self.terminate_reason, + "terminate_comment", + to_date("2018-02-13"), + terminate_lines_with_last_date_invoiced=True, + ) + self.assertTrue(self.contract.is_terminated) + self.assertEqual(self.acct_line.date_end, to_date("2018-02-14")) + + def test_stop_and_update_recurring_invoice_date(self): + self.acct_line.write( + { + "date_start": "2019-01-01", + "date_end": "2019-12-31", + "recurring_next_date": "2020-01-01", + "recurring_invoicing_type": "post-paid", + "recurring_rule_type": "yearly", + } + ) + self.acct_line.stop(to_date("2019-05-31")) + self.assertEqual(self.acct_line.date_end, to_date("2019-05-31")) + self.assertEqual(self.acct_line.recurring_next_date, to_date("2019-06-01")) diff --git a/contract_termination/views/contract_contract.xml b/contract_termination/views/contract_contract.xml new file mode 100644 index 0000000000..f9f082a542 --- /dev/null +++ b/contract_termination/views/contract_contract.xml @@ -0,0 +1,110 @@ + + + + + contract.contract + + + +