diff --git a/mrp_workorder_sequence/README.rst b/mrp_workorder_sequence/README.rst new file mode 100644 index 000000000..bd2ec6cbc --- /dev/null +++ b/mrp_workorder_sequence/README.rst @@ -0,0 +1,88 @@ +======================= +MRP Work Order Sequence +======================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github + :target: https://github.com/OCA/manufacture/tree/14.0/mrp_workorder_sequence + :alt: OCA/manufacture +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_workorder_sequence + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/129/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Provide a new field sequence on production orders's work orders, that provides +clear information on the process order of those. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Go to any production order with a routing set and check its work orders. + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ForgeFlow + +Contributors +~~~~~~~~~~~~ + +* Lois Rilo +* Pimolnat Suntian + +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-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px + :target: https://github.com/LoisRForgeFlow + :alt: LoisRForgeFlow + +Current `maintainer `__: + +|maintainer-LoisRForgeFlow| + +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_workorder_sequence/__init__.py b/mrp_workorder_sequence/__init__.py new file mode 100644 index 000000000..44f9fd7c1 --- /dev/null +++ b/mrp_workorder_sequence/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import models diff --git a/mrp_workorder_sequence/__manifest__.py b/mrp_workorder_sequence/__manifest__.py new file mode 100644 index 000000000..a4a70f7e3 --- /dev/null +++ b/mrp_workorder_sequence/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2019-20 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +{ + "name": "MRP Work Order Sequence", + "summary": "adds sequence to production work orders.", + "version": "15.0.1.0.1", + "category": "Manufacturing", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "development_status": "Beta", + "maintainers": ["LoisRForgeFlow"], + "website": "https://github.com/OCA/manufacture", + "license": "LGPL-3", + "depends": ["mrp"], + "data": ["views/mrp_workorder_view.xml"], + "installable": True, +} diff --git a/mrp_workorder_sequence/i18n/mrp_workorder_sequence.pot b/mrp_workorder_sequence/i18n/mrp_workorder_sequence.pot new file mode 100644 index 000000000..39d4fbce1 --- /dev/null +++ b/mrp_workorder_sequence/i18n/mrp_workorder_sequence.pot @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_workorder_sequence +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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: mrp_workorder_sequence +#: model:ir.model.fields,field_description:mrp_workorder_sequence.field_mrp_production__display_name +#: model:ir.model.fields,field_description:mrp_workorder_sequence.field_mrp_workorder__display_name +msgid "Display Name" +msgstr "" + +#. module: mrp_workorder_sequence +#: model:ir.model.fields,field_description:mrp_workorder_sequence.field_mrp_production__id +#: model:ir.model.fields,field_description:mrp_workorder_sequence.field_mrp_workorder__id +msgid "ID" +msgstr "" + +#. module: mrp_workorder_sequence +#: model:ir.model.fields,field_description:mrp_workorder_sequence.field_mrp_production____last_update +#: model:ir.model.fields,field_description:mrp_workorder_sequence.field_mrp_workorder____last_update +msgid "Last Modified on" +msgstr "" + +#. module: mrp_workorder_sequence +#: model:ir.model,name:mrp_workorder_sequence.model_mrp_production +msgid "Production Order" +msgstr "" + +#. module: mrp_workorder_sequence +#: model:ir.model.fields,field_description:mrp_workorder_sequence.field_mrp_workorder__sequence +msgid "Sequence" +msgstr "" + +#. module: mrp_workorder_sequence +#: model:ir.model,name:mrp_workorder_sequence.model_mrp_workorder +msgid "Work Order" +msgstr "" diff --git a/mrp_workorder_sequence/models/__init__.py b/mrp_workorder_sequence/models/__init__.py new file mode 100644 index 000000000..5a0ba17ab --- /dev/null +++ b/mrp_workorder_sequence/models/__init__.py @@ -0,0 +1,2 @@ +from . import mrp_production +from . import mrp_workorder diff --git a/mrp_workorder_sequence/models/mrp_production.py b/mrp_workorder_sequence/models/mrp_production.py new file mode 100644 index 000000000..a631994d0 --- /dev/null +++ b/mrp_workorder_sequence/models/mrp_production.py @@ -0,0 +1,20 @@ +# Copyright 2019-20 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import models + + +class MrpProduction(models.Model): + _inherit = "mrp.production" + + def _reset_work_order_sequence(self): + for rec in self: + current_sequence = 1 + for work in rec.workorder_ids: + work.sequence = current_sequence + current_sequence += 1 + + def _create_workorder(self): + res = super()._create_workorder() + self._reset_work_order_sequence() + return res diff --git a/mrp_workorder_sequence/models/mrp_workorder.py b/mrp_workorder_sequence/models/mrp_workorder.py new file mode 100644 index 000000000..e350595a5 --- /dev/null +++ b/mrp_workorder_sequence/models/mrp_workorder.py @@ -0,0 +1,10 @@ +# Copyright 2019-20 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import fields, models + + +class MrpWorkOrder(models.Model): + _inherit = "mrp.workorder" + + sequence = fields.Integer() diff --git a/mrp_workorder_sequence/readme/CONTRIBUTORS.rst b/mrp_workorder_sequence/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..f70560233 --- /dev/null +++ b/mrp_workorder_sequence/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Lois Rilo +* Pimolnat Suntian +* Christopher Ormaza diff --git a/mrp_workorder_sequence/readme/DESCRIPTION.rst b/mrp_workorder_sequence/readme/DESCRIPTION.rst new file mode 100644 index 000000000..38ab09bc0 --- /dev/null +++ b/mrp_workorder_sequence/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Provide a new field sequence on production orders's work orders, that provides +clear information on the process order of those. diff --git a/mrp_workorder_sequence/readme/USAGE.rst b/mrp_workorder_sequence/readme/USAGE.rst new file mode 100644 index 000000000..5067d94df --- /dev/null +++ b/mrp_workorder_sequence/readme/USAGE.rst @@ -0,0 +1 @@ +Go to any production order with a routing set and check its work orders. diff --git a/mrp_workorder_sequence/static/description/icon.png b/mrp_workorder_sequence/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/mrp_workorder_sequence/static/description/icon.png differ diff --git a/mrp_workorder_sequence/static/description/index.html b/mrp_workorder_sequence/static/description/index.html new file mode 100644 index 000000000..273803cca --- /dev/null +++ b/mrp_workorder_sequence/static/description/index.html @@ -0,0 +1,428 @@ + + + + + + +MRP Work Order Sequence + + + +
+

MRP Work Order Sequence

+ + +

Beta License: LGPL-3 OCA/manufacture Translate me on Weblate Try me on Runbot

+

Provide a new field sequence on production orders’s work orders, that provides +clear information on the process order of those.

+

Table of contents

+ +
+

Usage

+

Go to any production order with a routing set and check its work orders.

+
+
+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
+
+
+

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.

+

Current maintainer:

+

LoisRForgeFlow

+

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_workorder_sequence/tests/__init__.py b/mrp_workorder_sequence/tests/__init__.py new file mode 100644 index 000000000..01629ad73 --- /dev/null +++ b/mrp_workorder_sequence/tests/__init__.py @@ -0,0 +1 @@ +from . import test_mrp_workorder_sequence diff --git a/mrp_workorder_sequence/tests/test_mrp_workorder_sequence.py b/mrp_workorder_sequence/tests/test_mrp_workorder_sequence.py new file mode 100644 index 000000000..f9206f7c8 --- /dev/null +++ b/mrp_workorder_sequence/tests/test_mrp_workorder_sequence.py @@ -0,0 +1,111 @@ +# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import Command +from odoo.tests import Form + +from odoo.addons.mrp.tests.test_bom import TestBoM + + +class TestMrpWorkorderSequence(TestBoM): + def test_mrp_workorder_sequence(self): + self.env["mrp.bom"].create( + { + "product_tmpl_id": self.product_7_template.id, + "product_uom_id": self.uom_unit.id, + "product_qty": 4.0, + "type": "normal", + "operation_ids": [ + Command.create( + { + "name": "Cutting Machine", + "workcenter_id": self.workcenter_1.id, + "time_cycle": 12, + "sequence": 1, + } + ), + Command.create( + { + "name": "Weld Machine", + "workcenter_id": self.workcenter_1.id, + "time_cycle": 18, + "sequence": 2, + "bom_product_template_attribute_value_ids": [ + Command.link(self.product_7_attr1_v1.id) + ], + } + ), + Command.create( + { + "name": "Taking a coffee", + "workcenter_id": self.workcenter_1.id, + "time_cycle": 5, + "sequence": 3, + "bom_product_template_attribute_value_ids": [ + Command.link(self.product_7_attr1_v2.id) + ], + } + ), + ], + "byproduct_ids": [ + Command.create( + { + "product_id": self.product_1.id, + "product_uom_id": self.product_1.uom_id.id, + "product_qty": 1, + } + ), + Command.create( + { + "product_id": self.product_2.id, + "product_uom_id": self.product_2.uom_id.id, + "product_qty": 1, + "bom_product_template_attribute_value_ids": [ + Command.link(self.product_7_attr1_v1.id) + ], + } + ), + Command.create( + { + "product_id": self.product_3.id, + "product_uom_id": self.product_3.uom_id.id, + "product_qty": 1, + "bom_product_template_attribute_value_ids": [ + Command.link(self.product_7_attr1_v2.id) + ], + } + ), + ], + "bom_line_ids": [ + Command.create( + { + "product_id": self.product_2.id, + "product_qty": 2, + } + ), + Command.create( + { + "product_id": self.product_3.id, + "product_qty": 2, + "bom_product_template_attribute_value_ids": [ + Command.link(self.product_7_attr1_v1.id) + ], + } + ), + Command.create( + { + "product_id": self.product_4.id, + "product_qty": 2, + "bom_product_template_attribute_value_ids": [ + Command.link(self.product_7_attr1_v2.id) + ], + } + ), + ], + } + ) + mrp_order_form = Form(self.env["mrp.production"]) + mrp_order_form.product_id = self.product_7_3 + mrp_order = mrp_order_form.save() + for workorder in mrp_order.workorder_ids: + self.assertEqual(workorder.sequence, workorder.operation_id.sequence) diff --git a/mrp_workorder_sequence/views/mrp_workorder_view.xml b/mrp_workorder_sequence/views/mrp_workorder_view.xml new file mode 100644 index 000000000..2514a7493 --- /dev/null +++ b/mrp_workorder_sequence/views/mrp_workorder_view.xml @@ -0,0 +1,16 @@ + + + + mrp.workorder.tree + mrp.workorder + + + + + + + + diff --git a/setup/mrp_workorder_sequence/odoo/addons/mrp_workorder_sequence b/setup/mrp_workorder_sequence/odoo/addons/mrp_workorder_sequence new file mode 120000 index 000000000..413aae71c --- /dev/null +++ b/setup/mrp_workorder_sequence/odoo/addons/mrp_workorder_sequence @@ -0,0 +1 @@ +../../../../mrp_workorder_sequence \ No newline at end of file diff --git a/setup/mrp_workorder_sequence/setup.py b/setup/mrp_workorder_sequence/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/mrp_workorder_sequence/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)