diff --git a/mrp_set_quantity_to_reservation/README.rst b/mrp_set_quantity_to_reservation/README.rst new file mode 100644 index 000000000..a445c070f --- /dev/null +++ b/mrp_set_quantity_to_reservation/README.rst @@ -0,0 +1,91 @@ +=============================== +MRP Set Quantity To Reservation +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bf57d7cafed692fe20d0710b88e16940f6dd8eeda49c9490253d6468ede6ded8 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fmanufacture-lightgray.png?logo=github + :target: https://github.com/OCA/manufacture/tree/15.0/mrp_set_quantity_to_reservation + :alt: OCA/manufacture +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_set_quantity_to_reservation + :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/manufacture&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds the button "Set quantities" on productions. By clicking this button +the quantity done on each material consumption will be filled with the reservation. + +**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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `__: + + * Carlos Roca + * Sergio Teruel + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-CarlosRoca13| image:: https://github.com/CarlosRoca13.png?size=40px + :target: https://github.com/CarlosRoca13 + :alt: CarlosRoca13 +.. |maintainer-sergio-teruel| image:: https://github.com/sergio-teruel.png?size=40px + :target: https://github.com/sergio-teruel + :alt: sergio-teruel + +Current `maintainers `__: + +|maintainer-CarlosRoca13| |maintainer-sergio-teruel| + +This module is part of the `OCA/manufacture `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mrp_set_quantity_to_reservation/__init__.py b/mrp_set_quantity_to_reservation/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/mrp_set_quantity_to_reservation/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mrp_set_quantity_to_reservation/__manifest__.py b/mrp_set_quantity_to_reservation/__manifest__.py new file mode 100644 index 000000000..429c9a4af --- /dev/null +++ b/mrp_set_quantity_to_reservation/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2024 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) +{ + "name": "MRP Set Quantity To Reservation", + "version": "15.0.0.1.0", + "development_status": "Beta", + "license": "AGPL-3", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": [ + "CarlosRoca13", + "sergio-teruel", + ], + "website": "https://github.com/OCA/manufacture", + "category": "Manufacturing", + "depends": [ + "mrp", + ], + "data": ["views/mrp_production_views.xml"], + "installable": True, + "auto_install": True, + "application": False, +} diff --git a/mrp_set_quantity_to_reservation/i18n/es.po b/mrp_set_quantity_to_reservation/i18n/es.po new file mode 100644 index 000000000..e1c8e7830 --- /dev/null +++ b/mrp_set_quantity_to_reservation/i18n/es.po @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_set_quantity_to_reservation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-06-11 13:52+0000\n" +"PO-Revision-Date: 2024-06-11 15:54+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.0.1\n" + +#. module: mrp_set_quantity_to_reservation +#: model:ir.model,name:mrp_set_quantity_to_reservation.model_mrp_production +msgid "Production Order" +msgstr "Orden de producción" + +#. module: mrp_set_quantity_to_reservation +#: model_terms:ir.ui.view,arch_db:mrp_set_quantity_to_reservation.mrp_production_form_view +msgid "Set quantities" +msgstr "Establecer cantidades" diff --git a/mrp_set_quantity_to_reservation/i18n/mrp_set_quantity_to_reservation.pot b/mrp_set_quantity_to_reservation/i18n/mrp_set_quantity_to_reservation.pot new file mode 100644 index 000000000..6681c03b9 --- /dev/null +++ b/mrp_set_quantity_to_reservation/i18n/mrp_set_quantity_to_reservation.pot @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_set_quantity_to_reservation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-06-11 13:52+0000\n" +"PO-Revision-Date: 2024-06-11 13:52+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: mrp_set_quantity_to_reservation +#: model:ir.model,name:mrp_set_quantity_to_reservation.model_mrp_production +msgid "Production Order" +msgstr "" + +#. module: mrp_set_quantity_to_reservation +#: model_terms:ir.ui.view,arch_db:mrp_set_quantity_to_reservation.mrp_production_form_view +msgid "Set quantities" +msgstr "" diff --git a/mrp_set_quantity_to_reservation/models/__init__.py b/mrp_set_quantity_to_reservation/models/__init__.py new file mode 100644 index 000000000..a9e5f13e4 --- /dev/null +++ b/mrp_set_quantity_to_reservation/models/__init__.py @@ -0,0 +1 @@ +from . import mrp_production diff --git a/mrp_set_quantity_to_reservation/models/mrp_production.py b/mrp_set_quantity_to_reservation/models/mrp_production.py new file mode 100644 index 000000000..c5155661b --- /dev/null +++ b/mrp_set_quantity_to_reservation/models/mrp_production.py @@ -0,0 +1,11 @@ +# Copyright 2024 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import models + + +class MrpProduction(models.Model): + _inherit = "mrp.production" + + def action_set_quantities_to_reservation(self): + self.move_raw_ids._set_quantities_to_reservation() diff --git a/mrp_set_quantity_to_reservation/readme/CONTRIBUTORS.rst b/mrp_set_quantity_to_reservation/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..0470c21b0 --- /dev/null +++ b/mrp_set_quantity_to_reservation/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `__: + + * Carlos Roca + * Sergio Teruel diff --git a/mrp_set_quantity_to_reservation/readme/DESCRIPTION.rst b/mrp_set_quantity_to_reservation/readme/DESCRIPTION.rst new file mode 100644 index 000000000..9c054f95d --- /dev/null +++ b/mrp_set_quantity_to_reservation/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module adds the button "Set quantities" on productions. By clicking this button +the quantity done on each material consumption will be filled with the reservation. diff --git a/mrp_set_quantity_to_reservation/static/description/index.html b/mrp_set_quantity_to_reservation/static/description/index.html new file mode 100644 index 000000000..1f21d7039 --- /dev/null +++ b/mrp_set_quantity_to_reservation/static/description/index.html @@ -0,0 +1,430 @@ + + + + + +MRP Set Quantity To Reservation + + + +
+

MRP Set Quantity To Reservation

+ + +

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

+

This module adds the button “Set quantities” on productions. By clicking this button +the quantity done on each material consumption will be filled with the reservation.

+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Carlos Roca
    • +
    • Sergio Teruel
    • +
    +
  • +
+
+
+

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.

+

Current maintainers:

+

CarlosRoca13 sergio-teruel

+

This module is part of the OCA/manufacture project on GitHub.

+

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

+
+
+
+ + diff --git a/mrp_set_quantity_to_reservation/tests/__init__.py b/mrp_set_quantity_to_reservation/tests/__init__.py new file mode 100644 index 000000000..de69c9bb4 --- /dev/null +++ b/mrp_set_quantity_to_reservation/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mrp_set_quantity_to_reservation diff --git a/mrp_set_quantity_to_reservation/tests/test_mrp_set_quantity_to_reservation.py b/mrp_set_quantity_to_reservation/tests/test_mrp_set_quantity_to_reservation.py new file mode 100644 index 000000000..0fcdbff93 --- /dev/null +++ b/mrp_set_quantity_to_reservation/tests/test_mrp_set_quantity_to_reservation.py @@ -0,0 +1,54 @@ +# Copyright 2024 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo.tests import tagged +from odoo.tests.common import Form, TransactionCase + + +@tagged("post_install", "-at_install") +class TestMrpSetQuantityToReservation(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product = cls.env["product.product"].create( + {"name": "Test product", "type": "product"} + ) + cls.component = cls.env["product.product"].create( + {"name": "Test component", "type": "product"} + ) + updatate_qty_data = cls.component.action_update_quantity_on_hand() + stock_quant_form = Form( + cls.env["stock.quant"].with_context(**updatate_qty_data["context"]), + view="stock.view_stock_quant_tree_inventory_editable", + ) + stock_quant_form.inventory_quantity = 20 + quant = stock_quant_form.save() + quant.action_apply_inventory() + cls.bom = cls.env["mrp.bom"].create( + { + "product_id": cls.product.id, + "product_tmpl_id": cls.product.product_tmpl_id.id, + "product_uom_id": cls.product.uom_id.id, + "product_qty": 1.0, + "type": "normal", + } + ) + cls.env["mrp.bom.line"].create( + {"bom_id": cls.bom.id, "product_id": cls.component.id, "product_qty": 2} + ) + + def test_set_quantity_to_reservation(self): + mrp_form = Form(self.env["mrp.production"]) + mrp_form.product_id = self.product + mrp = mrp_form.save() + self.assertEqual(mrp.bom_id, self.bom) + mrp.action_confirm() + mrp.action_set_quantities_to_reservation() + self.assertEqual(mrp.move_raw_ids.quantity_done, 2) + mrp_form = Form(self.env["mrp.production"]) + mrp_form.product_id = self.product + mrp_form.product_qty = 10 + mrp_2 = mrp_form.save() + mrp_2.action_confirm() + mrp_2.action_set_quantities_to_reservation() + self.assertEqual(mrp_2.move_raw_ids.quantity_done, 18) diff --git a/mrp_set_quantity_to_reservation/views/mrp_production_views.xml b/mrp_set_quantity_to_reservation/views/mrp_production_views.xml new file mode 100644 index 000000000..f841c92f9 --- /dev/null +++ b/mrp_set_quantity_to_reservation/views/mrp_production_views.xml @@ -0,0 +1,25 @@ + + + + + + mrp.production + + + + + + + diff --git a/setup/mrp_set_quantity_to_reservation/odoo/addons/mrp_set_quantity_to_reservation b/setup/mrp_set_quantity_to_reservation/odoo/addons/mrp_set_quantity_to_reservation new file mode 120000 index 000000000..c0303f31d --- /dev/null +++ b/setup/mrp_set_quantity_to_reservation/odoo/addons/mrp_set_quantity_to_reservation @@ -0,0 +1 @@ +../../../../mrp_set_quantity_to_reservation \ No newline at end of file diff --git a/setup/mrp_set_quantity_to_reservation/setup.py b/setup/mrp_set_quantity_to_reservation/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_set_quantity_to_reservation/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)