diff --git a/mrp_bom_line_sequence/README.rst b/mrp_bom_line_sequence/README.rst new file mode 100644 index 000000000..78e86abf2 --- /dev/null +++ b/mrp_bom_line_sequence/README.rst @@ -0,0 +1,80 @@ +============================== +BOM lines with sequence number +============================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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-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/13.0/mrp_bom_line_sequence + :alt: OCA/manufacture +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/manufacture-13-0/manufacture-13-0-mrp_bom_line_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/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Provide a new field sequence on bom components, which allows to manage the +order of moves in a picking. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Add custom sequence if needed, if not just let the system to sort the lines. + +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 +~~~~~~~~~~~~ + +* Eficent Business and IT Consulting Services S.L. +* 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. + +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_bom_line_sequence/__init__.py b/mrp_bom_line_sequence/__init__.py new file mode 100644 index 000000000..4b76c7b2d --- /dev/null +++ b/mrp_bom_line_sequence/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/mrp_bom_line_sequence/__manifest__.py b/mrp_bom_line_sequence/__manifest__.py new file mode 100644 index 000000000..dab93553b --- /dev/null +++ b/mrp_bom_line_sequence/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2019-20 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "BOM lines with sequence number", + "summary": "Manages the order of BOM lines by displaying its sequence", + "version": "13.0.1.0.0", + "category": "Manufacturing Management", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/manufacture", + "license": "AGPL-3", + "depends": ["mrp"], + "data": ["views/stock_view.xml"], + "installable": True, +} diff --git a/mrp_bom_line_sequence/i18n/hr.po b/mrp_bom_line_sequence/i18n/hr.po new file mode 100644 index 000000000..47ef18bfd --- /dev/null +++ b/mrp_bom_line_sequence/i18n/hr.po @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_bom_line_sequence +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-12-04 14:04+0000\n" +"Last-Translator: Bole \n" +"Language-Team: none\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=" +"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 3.9.1\n" + +#. module: mrp_bom_line_sequence +#: model_terms:ir.ui.view,arch_db:mrp_bom_line_sequence.mrp_bom_form_view +msgid "\"handle\"" +msgstr "\"drška\"" + +#. module: mrp_bom_line_sequence +#: model:ir.model,name:mrp_bom_line_sequence.model_mrp_bom +msgid "Bill of Material" +msgstr "Sastavnica" + +#. module: mrp_bom_line_sequence +#: model:ir.model,name:mrp_bom_line_sequence.model_mrp_bom_line +msgid "Bill of Material Line" +msgstr "Stavka sastavnice" + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,help:mrp_bom_line_sequence.field_mrp_bom_line__sequence +msgid "Gives the sequence order when displaying." +msgstr "Definira redosljed prikaza." + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,field_description:mrp_bom_line_sequence.field_mrp_bom__max_line_sequence +msgid "Max sequence in lines" +msgstr "Max redosljed u stavkama" + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,field_description:mrp_bom_line_sequence.field_mrp_bom_line__sequence2 +msgid "Sequence" +msgstr "Sekvenca" + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,help:mrp_bom_line_sequence.field_mrp_bom_line__sequence2 +msgid "Shows the sequence in the BOM line." +msgstr "Prikazuje sekvencu u stavkama." + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,field_description:mrp_bom_line_sequence.field_mrp_bom_line__sequence +msgid "original sequence" +msgstr "originalna sekvenca" diff --git a/mrp_bom_line_sequence/i18n/mrp_bom_line_sequence.pot b/mrp_bom_line_sequence/i18n/mrp_bom_line_sequence.pot new file mode 100644 index 000000000..dc331531f --- /dev/null +++ b/mrp_bom_line_sequence/i18n/mrp_bom_line_sequence.pot @@ -0,0 +1,55 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_bom_line_sequence +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.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_bom_line_sequence +#: model_terms:ir.ui.view,arch_db:mrp_bom_line_sequence.mrp_bom_form_view +msgid "\"handle\"" +msgstr "" + +#. module: mrp_bom_line_sequence +#: model:ir.model,name:mrp_bom_line_sequence.model_mrp_bom +msgid "Bill of Material" +msgstr "" + +#. module: mrp_bom_line_sequence +#: model:ir.model,name:mrp_bom_line_sequence.model_mrp_bom_line +msgid "Bill of Material Line" +msgstr "" + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,help:mrp_bom_line_sequence.field_mrp_bom_line__sequence +msgid "Gives the sequence order when displaying." +msgstr "" + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,field_description:mrp_bom_line_sequence.field_mrp_bom__max_line_sequence +msgid "Max sequence in lines" +msgstr "" + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,field_description:mrp_bom_line_sequence.field_mrp_bom_line__sequence2 +msgid "Sequence" +msgstr "" + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,help:mrp_bom_line_sequence.field_mrp_bom_line__sequence2 +msgid "Shows the sequence in the BOM line." +msgstr "" + +#. module: mrp_bom_line_sequence +#: model:ir.model.fields,field_description:mrp_bom_line_sequence.field_mrp_bom_line__sequence +msgid "original sequence" +msgstr "" + diff --git a/mrp_bom_line_sequence/models/__init__.py b/mrp_bom_line_sequence/models/__init__.py new file mode 100644 index 000000000..be993e588 --- /dev/null +++ b/mrp_bom_line_sequence/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import mrp diff --git a/mrp_bom_line_sequence/models/mrp.py b/mrp_bom_line_sequence/models/mrp.py new file mode 100644 index 000000000..a29e41416 --- /dev/null +++ b/mrp_bom_line_sequence/models/mrp.py @@ -0,0 +1,57 @@ +# Copyright 2019-20 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class MrpBomLine(models.Model): + _inherit = "mrp.bom.line" + + # re-defines the field to change the default + sequence = fields.Integer(default=9999, string="original sequence") + + # displays sequence on the stock moves + sequence2 = fields.Integer( + help="Shows the sequence in the BOM line.", + string="Sequence", + related="sequence", + readonly=False, + store=True, + ) + + @api.model + def create(self, values): + move = super(MrpBomLine, self).create(values) + # We do not reset the sequence if we are copying a complete bom + if not self.env.context.get("keep_line_sequence", False): + move.bom_id._reset_sequence() + return move + + +class MrpBom(models.Model): + _inherit = "mrp.bom" + + @api.depends("bom_line_ids") + def _compute_max_line_sequence(self): + """Allow to know the highest sequence entered in move lines. + Then we add 1 to this value for the next sequence, this value is + passed to the context of the o2m field in the view. + So when we create new move line, the sequence is automatically + incremented by 1. (max_sequence + 1) + """ + for bom in self: + bom.max_line_sequence = max(bom.mapped("bom_line_ids.sequence") or [0]) + 1 + + max_line_sequence = fields.Integer( + string="Max sequence in lines", compute="_compute_max_line_sequence" + ) + + def _reset_sequence(self): + for rec in self: + current_sequence = 1 + for line in rec.bom_line_ids: + line.sequence = current_sequence + current_sequence += 1 + + def copy(self, default=None): + return super(MrpBom, self.with_context(keep_line_sequence=True)).copy(default) diff --git a/mrp_bom_line_sequence/readme/CONTRIBUTORS.rst b/mrp_bom_line_sequence/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..af69a89c6 --- /dev/null +++ b/mrp_bom_line_sequence/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Eficent Business and IT Consulting Services S.L. +* Pimolnat Suntian diff --git a/mrp_bom_line_sequence/readme/DESCRIPTION.rst b/mrp_bom_line_sequence/readme/DESCRIPTION.rst new file mode 100644 index 000000000..a1d133863 --- /dev/null +++ b/mrp_bom_line_sequence/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Provide a new field sequence on bom components, which allows to manage the +order of moves in a picking. diff --git a/mrp_bom_line_sequence/readme/USAGE.rst b/mrp_bom_line_sequence/readme/USAGE.rst new file mode 100644 index 000000000..2d1769bb7 --- /dev/null +++ b/mrp_bom_line_sequence/readme/USAGE.rst @@ -0,0 +1 @@ +Add custom sequence if needed, if not just let the system to sort the lines. diff --git a/mrp_bom_line_sequence/static/description/icon.png b/mrp_bom_line_sequence/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/mrp_bom_line_sequence/static/description/icon.png differ diff --git a/mrp_bom_line_sequence/static/description/index.html b/mrp_bom_line_sequence/static/description/index.html new file mode 100644 index 000000000..3266ec767 --- /dev/null +++ b/mrp_bom_line_sequence/static/description/index.html @@ -0,0 +1,426 @@ + + + + + + +BOM lines with sequence number + + + +
+

BOM lines with sequence number

+ + +

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

+

Provide a new field sequence on bom components, which allows to manage the +order of moves in a picking.

+

Table of contents

+ +
+

Usage

+

Add custom sequence if needed, if not just let the system to sort the lines.

+
+
+

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.

+

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_bom_line_sequence/views/stock_view.xml b/mrp_bom_line_sequence/views/stock_view.xml new file mode 100644 index 000000000..f4af8d6ad --- /dev/null +++ b/mrp_bom_line_sequence/views/stock_view.xml @@ -0,0 +1,25 @@ + + + + + mrp.bom.form + mrp.bom + + + + "handle" + + + + + mrp.bom.form + mrp.bom + + + + + + + + +