diff --git a/stock_move_reset_quantity/README.rst b/stock_move_reset_quantity/README.rst new file mode 100644 index 0000000..41e11a4 --- /dev/null +++ b/stock_move_reset_quantity/README.rst @@ -0,0 +1,80 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +========================= +Move Stock Reset Quantity +========================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:3a73d14b10ac9521d635b40a2d506a1aeed579e6384a3b86c55ce8f8c6c09717 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fstock--logistics--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/18.0/stock_move_reset_quantity + :alt: OCA/stock-logistics-warehouse +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-18-0/stock-logistics-warehouse-18-0-stock_move_reset_quantity + :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/stock-logistics-warehouse&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to reset quantities on all moves / move lines. + +**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 +------- + +* BCIM + +Contributors +------------ + +- Jacques-Etienne Baudoux (BCIM) + +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/stock-logistics-warehouse `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_move_reset_quantity/__init__.py b/stock_move_reset_quantity/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/stock_move_reset_quantity/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_move_reset_quantity/__manifest__.py b/stock_move_reset_quantity/__manifest__.py new file mode 100644 index 0000000..714bf43 --- /dev/null +++ b/stock_move_reset_quantity/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2025 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "Move Stock Reset Quantity", + "version": "18.0.1.0.0", + "author": "BCIM, Odoo Community Association (OCA)", + "summary": "Reset quantity to zero", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "license": "AGPL-3", + "depends": ["stock"], + "category": "Stock", + "data": [ + "views/stock_move_line.xml", + "views/stock_picking.xml", + ], +} diff --git a/stock_move_reset_quantity/i18n/it.po b/stock_move_reset_quantity/i18n/it.po new file mode 100644 index 0000000..0d77c79 --- /dev/null +++ b/stock_move_reset_quantity/i18n/it.po @@ -0,0 +1,33 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_move_reset_quantity +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-06-11 08:26+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: stock_move_reset_quantity +#: model:ir.model,name:stock_move_reset_quantity.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "Movimenti prodotto (riga movimento di magazzino)" + +#. module: stock_move_reset_quantity +#: model_terms:ir.ui.view,arch_db:stock_move_reset_quantity.view_picking_form +#: model_terms:ir.ui.view,arch_db:stock_move_reset_quantity.view_stock_move_line_detailed_operation_tree +msgid "Reset Quantities" +msgstr "Resetta quantità" + +#. module: stock_move_reset_quantity +#: model:ir.model,name:stock_move_reset_quantity.model_stock_picking +msgid "Transfer" +msgstr "Trasferimento" diff --git a/stock_move_reset_quantity/i18n/ja.po b/stock_move_reset_quantity/i18n/ja.po new file mode 100644 index 0000000..9565839 --- /dev/null +++ b/stock_move_reset_quantity/i18n/ja.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_move_reset_quantity +# +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: stock_move_reset_quantity +#: model:ir.model,name:stock_move_reset_quantity.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "プロダクトの移動(在庫移動ライン)" + +#. module: stock_move_reset_quantity +#: model_terms:ir.ui.view,arch_db:stock_move_reset_quantity.view_picking_form +#: model_terms:ir.ui.view,arch_db:stock_move_reset_quantity.view_stock_move_line_detailed_operation_tree +msgid "Reset Quantities" +msgstr "数量をリセット" + +#. module: stock_move_reset_quantity +#: model:ir.model,name:stock_move_reset_quantity.model_stock_picking +msgid "Transfer" +msgstr "転送" diff --git a/stock_move_reset_quantity/i18n/stock_move_reset_quantity.pot b/stock_move_reset_quantity/i18n/stock_move_reset_quantity.pot new file mode 100644 index 0000000..b72aa91 --- /dev/null +++ b/stock_move_reset_quantity/i18n/stock_move_reset_quantity.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_move_reset_quantity +# +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: stock_move_reset_quantity +#: model:ir.model,name:stock_move_reset_quantity.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "" + +#. module: stock_move_reset_quantity +#: model_terms:ir.ui.view,arch_db:stock_move_reset_quantity.view_picking_form +#: model_terms:ir.ui.view,arch_db:stock_move_reset_quantity.view_stock_move_line_detailed_operation_tree +msgid "Reset Quantities" +msgstr "" + +#. module: stock_move_reset_quantity +#: model:ir.model,name:stock_move_reset_quantity.model_stock_picking +msgid "Transfer" +msgstr "" diff --git a/stock_move_reset_quantity/models/__init__.py b/stock_move_reset_quantity/models/__init__.py new file mode 100644 index 0000000..1645149 --- /dev/null +++ b/stock_move_reset_quantity/models/__init__.py @@ -0,0 +1,2 @@ +from . import stock_move_line +from . import stock_picking diff --git a/stock_move_reset_quantity/models/stock_move_line.py b/stock_move_reset_quantity/models/stock_move_line.py new file mode 100644 index 0000000..2cccfa3 --- /dev/null +++ b/stock_move_reset_quantity/models/stock_move_line.py @@ -0,0 +1,13 @@ +# Copyright 2025 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import models + + +class StockMoveLine(models.Model): + _inherit = "stock.move.line" + + def action_reset_quantity(self): + self.filtered( + lambda m: m.state in ("partially_available", "assigned") + ).quantity = 0 diff --git a/stock_move_reset_quantity/models/stock_picking.py b/stock_move_reset_quantity/models/stock_picking.py new file mode 100644 index 0000000..e811fb8 --- /dev/null +++ b/stock_move_reset_quantity/models/stock_picking.py @@ -0,0 +1,11 @@ +# Copyright 2025 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import models + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + def action_reset_quantity(self): + self.move_line_ids.action_reset_quantity() diff --git a/stock_move_reset_quantity/pyproject.toml b/stock_move_reset_quantity/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/stock_move_reset_quantity/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_move_reset_quantity/readme/CONTRIBUTORS.md b/stock_move_reset_quantity/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..1bc48d2 --- /dev/null +++ b/stock_move_reset_quantity/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Jacques-Etienne Baudoux (BCIM) \<\> diff --git a/stock_move_reset_quantity/readme/DESCRIPTION.md b/stock_move_reset_quantity/readme/DESCRIPTION.md new file mode 100644 index 0000000..fa11cb7 --- /dev/null +++ b/stock_move_reset_quantity/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows to reset quantities on all moves / move lines. diff --git a/stock_move_reset_quantity/static/description/icon.png b/stock_move_reset_quantity/static/description/icon.png new file mode 100644 index 0000000..1dcc49c Binary files /dev/null and b/stock_move_reset_quantity/static/description/icon.png differ diff --git a/stock_move_reset_quantity/static/description/index.html b/stock_move_reset_quantity/static/description/index.html new file mode 100644 index 0000000..c5a2a1a --- /dev/null +++ b/stock_move_reset_quantity/static/description/index.html @@ -0,0 +1,429 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Move Stock Reset Quantity

+ +

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

+

This module allows to reset quantities on all moves / move lines.

+

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

+
    +
  • BCIM
  • +
+
+
+

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/stock-logistics-warehouse project on GitHub.

+

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

+
+
+
+
+ + diff --git a/stock_move_reset_quantity/tests/__init__.py b/stock_move_reset_quantity/tests/__init__.py new file mode 100644 index 0000000..ed8c219 --- /dev/null +++ b/stock_move_reset_quantity/tests/__init__.py @@ -0,0 +1 @@ +from . import test_reset_quantity diff --git a/stock_move_reset_quantity/tests/test_reset_quantity.py b/stock_move_reset_quantity/tests/test_reset_quantity.py new file mode 100644 index 0000000..d019b45 --- /dev/null +++ b/stock_move_reset_quantity/tests/test_reset_quantity.py @@ -0,0 +1,30 @@ +# Copyright 2025 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import Form + +from odoo.addons.base.tests.common import BaseCommon + + +class TestResetQuantity(BaseCommon): + def test_reset_quantity(self): + picking = Form( + self.env["stock.picking"].with_context( + default_picking_type_id=self.ref("stock.picking_type_in") + ) + ) + self.product = self.env["product.product"].create( + { + "name": "Product Reset Quantity", + "is_storable": True, + "categ_id": self.env.ref("product.product_category_all").id, + } + ) + with picking.move_ids_without_package.new() as move: + move.product_id = self.product + move.product_uom_qty = 2.0 + picking = picking.save() + picking.action_assign() + self.assertEqual(picking.move_ids.quantity, 2.0) + picking.action_reset_quantity() + self.assertEqual(picking.move_ids.quantity, 0.0) diff --git a/stock_move_reset_quantity/views/stock_move_line.xml b/stock_move_reset_quantity/views/stock_move_line.xml new file mode 100644 index 0000000..0e1bd73 --- /dev/null +++ b/stock_move_reset_quantity/views/stock_move_line.xml @@ -0,0 +1,22 @@ + + + + stock.move.line.list reset quantity + stock.move.line + + + + + + diff --git a/stock_move_reset_quantity/views/stock_picking.xml b/stock_move_reset_quantity/views/stock_picking.xml new file mode 100644 index 0000000..c3845d6 --- /dev/null +++ b/stock_move_reset_quantity/views/stock_picking.xml @@ -0,0 +1,20 @@ + + + + stock.picking.form reset quantity + stock.picking + + + +