From a6e294735ae097dae78576f4d3e25c48c12f97b6 Mon Sep 17 00:00:00 2001 From: Mathieu Date: Tue, 9 Dec 2025 12:49:58 +0100 Subject: [PATCH] [14.0][ADD] purchase_order_mass_cancel --- purchase_order_mass_cancel/README.rst | 77 ++++ purchase_order_mass_cancel/__init__.py | 1 + purchase_order_mass_cancel/__manifest__.py | 17 + purchase_order_mass_cancel/i18n/fr.po | 77 ++++ .../i18n/purchase_order_mass_cancel.pot | 77 ++++ .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 2 + .../security/ir.model.access.csv | 2 + .../static/description/index.html | 424 ++++++++++++++++++ purchase_order_mass_cancel/tests/__init__.py | 1 + .../tests/test_purchase_order_mass_cancel.py | 23 + purchase_order_mass_cancel/wizard/__init__.py | 1 + .../wizard/purchase_order_mass_cancel.py | 12 + .../wizard/purchase_order_mass_cancel.xml | 33 ++ .../odoo/addons/purchase_order_mass_cancel | 1 + setup/purchase_order_mass_cancel/setup.py | 6 + 16 files changed, 755 insertions(+) create mode 100644 purchase_order_mass_cancel/README.rst create mode 100644 purchase_order_mass_cancel/__init__.py create mode 100644 purchase_order_mass_cancel/__manifest__.py create mode 100644 purchase_order_mass_cancel/i18n/fr.po create mode 100644 purchase_order_mass_cancel/i18n/purchase_order_mass_cancel.pot create mode 100644 purchase_order_mass_cancel/readme/CONTRIBUTORS.rst create mode 100644 purchase_order_mass_cancel/readme/DESCRIPTION.rst create mode 100644 purchase_order_mass_cancel/security/ir.model.access.csv create mode 100644 purchase_order_mass_cancel/static/description/index.html create mode 100644 purchase_order_mass_cancel/tests/__init__.py create mode 100644 purchase_order_mass_cancel/tests/test_purchase_order_mass_cancel.py create mode 100644 purchase_order_mass_cancel/wizard/__init__.py create mode 100644 purchase_order_mass_cancel/wizard/purchase_order_mass_cancel.py create mode 100644 purchase_order_mass_cancel/wizard/purchase_order_mass_cancel.xml create mode 120000 setup/purchase_order_mass_cancel/odoo/addons/purchase_order_mass_cancel create mode 100644 setup/purchase_order_mass_cancel/setup.py diff --git a/purchase_order_mass_cancel/README.rst b/purchase_order_mass_cancel/README.rst new file mode 100644 index 00000000000..d83c43fa5a0 --- /dev/null +++ b/purchase_order_mass_cancel/README.rst @@ -0,0 +1,77 @@ +========================== +Purchase Order Mass Cancel +========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5507b7f819df38c41805df241c43d73c33cf6897a52153549b75ab909ae52097 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fpurchase--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/purchase-workflow/tree/14.0/purchase_order_mass_cancel + :alt: OCA/purchase-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_order_mass_cancel + :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/purchase-workflow&target_branch=14.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to cancel multiple purchase orders at once using a single action. +This action is only available in the purchase list view. + +**Table of contents** + +.. contents:: + :local: + +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 +~~~~~~~ + +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Mathieu Delva + +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/purchase-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/purchase_order_mass_cancel/__init__.py b/purchase_order_mass_cancel/__init__.py new file mode 100644 index 00000000000..40272379f72 --- /dev/null +++ b/purchase_order_mass_cancel/__init__.py @@ -0,0 +1 @@ +from . import wizard diff --git a/purchase_order_mass_cancel/__manifest__.py b/purchase_order_mass_cancel/__manifest__.py new file mode 100644 index 00000000000..1da11177689 --- /dev/null +++ b/purchase_order_mass_cancel/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2025 Akretion (https://www.akretion.com). +# @author Mathieu DELVA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Purchase Order Mass Cancel", + "summary": "", + "version": "14.0.1.0.0", + "category": "Purchase", + "website": "https://github.com/OCA/purchase-workflow", + "author": "Akretion, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["purchase"], + "data": [ + "security/ir.model.access.csv", + "wizard/purchase_order_mass_cancel.xml", + ], +} diff --git a/purchase_order_mass_cancel/i18n/fr.po b/purchase_order_mass_cancel/i18n/fr.po new file mode 100644 index 00000000000..186dde7c046 --- /dev/null +++ b/purchase_order_mass_cancel/i18n/fr.po @@ -0,0 +1,77 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_order_mass_cancel +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-09 11:34+0000\n" +"PO-Revision-Date: 2025-12-09 11:34+0000\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: purchase_order_mass_cancel +#: model_terms:ir.ui.view,arch_db:purchase_order_mass_cancel.purchase_order_mass_cancel_form +msgid "Cancel" +msgstr "Annuler" + +#. module: purchase_order_mass_cancel +#: model_terms:ir.ui.view,arch_db:purchase_order_mass_cancel.purchase_order_mass_cancel_form +msgid "Confirm" +msgstr "Confimer" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__create_uid +msgid "Created by" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__create_date +msgid "Created on" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model_terms:ir.ui.view,arch_db:purchase_order_mass_cancel.purchase_order_mass_cancel_form +msgid "Do you want to cancel all these purchase orders?" +msgstr "Souhaitez-vous annuler toutes ces commandes ?" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__id +msgid "ID" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__write_date +msgid "Last Updated on" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.actions.act_window,name:purchase_order_mass_cancel.purchase_order_mass_cancel_action +#: model_terms:ir.ui.view,arch_db:purchase_order_mass_cancel.purchase_order_mass_cancel_form +msgid "Mass Cancel" +msgstr "Annulation en masse" + +#. module: purchase_order_mass_cancel +#: model:ir.model,name:purchase_order_mass_cancel.model_purchase_order_mass_cancel +msgid "Wirzad Cancel PO" +msgstr "" diff --git a/purchase_order_mass_cancel/i18n/purchase_order_mass_cancel.pot b/purchase_order_mass_cancel/i18n/purchase_order_mass_cancel.pot new file mode 100644 index 00000000000..5be89e8ed1d --- /dev/null +++ b/purchase_order_mass_cancel/i18n/purchase_order_mass_cancel.pot @@ -0,0 +1,77 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * purchase_order_mass_cancel +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-09 11:34+0000\n" +"PO-Revision-Date: 2025-12-09 11:34+0000\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: purchase_order_mass_cancel +#: model_terms:ir.ui.view,arch_db:purchase_order_mass_cancel.purchase_order_mass_cancel_form +msgid "Cancel" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model_terms:ir.ui.view,arch_db:purchase_order_mass_cancel.purchase_order_mass_cancel_form +msgid "Confirm" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__create_uid +msgid "Created by" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__create_date +msgid "Created on" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__display_name +msgid "Display Name" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model_terms:ir.ui.view,arch_db:purchase_order_mass_cancel.purchase_order_mass_cancel_form +msgid "Do you want to cancel all these purchase orders?" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__id +msgid "ID" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel____last_update +msgid "Last Modified on" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model.fields,field_description:purchase_order_mass_cancel.field_purchase_order_mass_cancel__write_date +msgid "Last Updated on" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.actions.act_window,name:purchase_order_mass_cancel.purchase_order_mass_cancel_action +#: model_terms:ir.ui.view,arch_db:purchase_order_mass_cancel.purchase_order_mass_cancel_form +msgid "Mass Cancel" +msgstr "" + +#. module: purchase_order_mass_cancel +#: model:ir.model,name:purchase_order_mass_cancel.model_purchase_order_mass_cancel +msgid "Wirzad Cancel PO" +msgstr "" diff --git a/purchase_order_mass_cancel/readme/CONTRIBUTORS.rst b/purchase_order_mass_cancel/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..bec244e369e --- /dev/null +++ b/purchase_order_mass_cancel/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Mathieu Delva diff --git a/purchase_order_mass_cancel/readme/DESCRIPTION.rst b/purchase_order_mass_cancel/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..5d8f3ab96ad --- /dev/null +++ b/purchase_order_mass_cancel/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows you to cancel multiple purchase orders at once using a single action. +This action is only available in the purchase list view. \ No newline at end of file diff --git a/purchase_order_mass_cancel/security/ir.model.access.csv b/purchase_order_mass_cancel/security/ir.model.access.csv new file mode 100644 index 00000000000..ad53eff83d6 --- /dev/null +++ b/purchase_order_mass_cancel/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 +access_purchase_order_mass_cancel,purchase.order.mass.cancel,model_purchase_order_mass_cancel,purchase.group_purchase_user,1,1,1,1 diff --git a/purchase_order_mass_cancel/static/description/index.html b/purchase_order_mass_cancel/static/description/index.html new file mode 100644 index 00000000000..828d405be1c --- /dev/null +++ b/purchase_order_mass_cancel/static/description/index.html @@ -0,0 +1,424 @@ + + + + + +Purchase Order Mass Cancel + + + +
+

Purchase Order Mass Cancel

+ + +

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

+

This module allows you to cancel multiple purchase orders at once using a single action. +This action is only available in the purchase list view.

+

Table of contents

+ +
+

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

+
    +
  • Akretion
  • +
+
+
+

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

+

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

+
+
+
+ + diff --git a/purchase_order_mass_cancel/tests/__init__.py b/purchase_order_mass_cancel/tests/__init__.py new file mode 100644 index 00000000000..c71642bf458 --- /dev/null +++ b/purchase_order_mass_cancel/tests/__init__.py @@ -0,0 +1 @@ +from . import test_purchase_order_mass_cancel diff --git a/purchase_order_mass_cancel/tests/test_purchase_order_mass_cancel.py b/purchase_order_mass_cancel/tests/test_purchase_order_mass_cancel.py new file mode 100644 index 00000000000..53d011eec14 --- /dev/null +++ b/purchase_order_mass_cancel/tests/test_purchase_order_mass_cancel.py @@ -0,0 +1,23 @@ +# Copyright 2023 Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import SavepointCase + + +class TestPurchaseOrderMassCancel(SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.purchase = cls.env["purchase.order"].search([("state", "=", "draft")]) + cls.wizard = ( + cls.env["purchase.order.mass.cancel"] + .with_context(active_ids=cls.purchase.ids) + .create({}) + ) + + def test_mass_cancel(self): + all_state = all(state == "draft" for state in self.purchase.mapped("state")) + self.assertTrue(all_state) + self.wizard.confirm_cancel() + all_state = all(state == "cancel" for state in self.purchase.mapped("state")) + self.assertTrue(all_state) diff --git a/purchase_order_mass_cancel/wizard/__init__.py b/purchase_order_mass_cancel/wizard/__init__.py new file mode 100644 index 00000000000..a69a2207393 --- /dev/null +++ b/purchase_order_mass_cancel/wizard/__init__.py @@ -0,0 +1 @@ +from . import purchase_order_mass_cancel diff --git a/purchase_order_mass_cancel/wizard/purchase_order_mass_cancel.py b/purchase_order_mass_cancel/wizard/purchase_order_mass_cancel.py new file mode 100644 index 00000000000..640d0b92316 --- /dev/null +++ b/purchase_order_mass_cancel/wizard/purchase_order_mass_cancel.py @@ -0,0 +1,12 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models + + +class PurchaseOrderMassCancel(models.TransientModel): + _name = "purchase.order.mass.cancel" + _description = "Wirzad Cancel PO" + + def confirm_cancel(self): + orders = self.env["purchase.order"].browse(self.env.context.get("active_ids")) + orders.button_cancel() diff --git a/purchase_order_mass_cancel/wizard/purchase_order_mass_cancel.xml b/purchase_order_mass_cancel/wizard/purchase_order_mass_cancel.xml new file mode 100644 index 00000000000..1ad3df63920 --- /dev/null +++ b/purchase_order_mass_cancel/wizard/purchase_order_mass_cancel.xml @@ -0,0 +1,33 @@ + + + + + + purchase.order.mass.cancel.form + purchase.order.mass.cancel + +
+ Do you want to cancel all these purchase orders? +
+
+
+
+
+ + + Mass Cancel + purchase.order.mass.cancel + form + new + + list + + +
diff --git a/setup/purchase_order_mass_cancel/odoo/addons/purchase_order_mass_cancel b/setup/purchase_order_mass_cancel/odoo/addons/purchase_order_mass_cancel new file mode 120000 index 00000000000..67108107ea7 --- /dev/null +++ b/setup/purchase_order_mass_cancel/odoo/addons/purchase_order_mass_cancel @@ -0,0 +1 @@ +../../../../purchase_order_mass_cancel \ No newline at end of file diff --git a/setup/purchase_order_mass_cancel/setup.py b/setup/purchase_order_mass_cancel/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/purchase_order_mass_cancel/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)