Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions mrp_unbuild_restore_origin/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
==========================
Mrp Unbuild Restore Origin
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:25f5082feb1040b2404f6d5d61e8b6447cd261444c6d8d11c2b49e9b2e609a7a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/18.0/mrp_unbuild_restore_origin
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/manufacture-18-0/manufacture-18-0-mrp_unbuild_restore_origin
: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=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

| This module enhances the unbuild process of Manufacturing Orders by
retaining
| information from the original move lines.

- **Location Retention (Optional):** A boolean field is available to
retain the original
source and destination locations of the move lines during the unbuild
process, if needed.

**Table of contents**

.. contents::
:local:

Usage
=====

| If you want the components to be returned to the same locations they
were originally
| consumed from, enable the checkbox labeled **"Restore Components to
Original Location"**
| when creating the Unbuild Order. If this option is not enabled, Odoo
will follow its standard behavior.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/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 <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_unbuild_restore_origin%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Quartile

Contributors
------------

- `Quartile <https://www.quartile.co>`__:

- Aung Ko Ko Lin
- Yoshi Tashiro
- Toshikimi Shigenobu

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-yostashiro| image:: https://github.com/yostashiro.png?size=40px
:target: https://github.com/yostashiro
:alt: yostashiro
.. |maintainer-aungkokolin1997| image:: https://github.com/aungkokolin1997.png?size=40px
:target: https://github.com/aungkokolin1997
:alt: aungkokolin1997

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-yostashiro| |maintainer-aungkokolin1997|

This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/18.0/mrp_unbuild_restore_origin>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions mrp_unbuild_restore_origin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions mrp_unbuild_restore_origin/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Mrp Unbuild Restore Origin",
"version": "18.0.1.0.0",
"author": "Quartile, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"category": "Stock",
"license": "AGPL-3",
"depends": ["mrp"],
"data": ["views/mrp_unbuild_views.xml"],
"maintainers": ["yostashiro", "aungkokolin1997"],
"installable": True,
}
52 changes: 52 additions & 0 deletions mrp_unbuild_restore_origin/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_unbuild_restore_origin
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-06-04 08:14+0000\n"
"Last-Translator: mymage <[email protected]>\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: mrp_unbuild_restore_origin
#: model:ir.model.fields,help:mrp_unbuild_restore_origin.field_mrp_unbuild__restore_rm_stock_in_origin_loc
msgid ""
"If selected, components will be returned to the same location they were "
"taken from during manufacturing."
msgstr ""
"Se selezionata, i componenti verranno restituiti nella stessa ubicazione da "
"cui sono stati prelevati durante la produzione."

#. module: mrp_unbuild_restore_origin
#: model:ir.model.fields,field_description:mrp_unbuild_restore_origin.field_mrp_unbuild__restore_rm_stock_in_origin_loc
msgid "Return Components to Original Location"
msgstr "Reso componenti nell'ubicazione di origine"

#. module: mrp_unbuild_restore_origin
#: model:ir.model,name:mrp_unbuild_restore_origin.model_stock_move
msgid "Stock Move"
msgstr "Movimento di magazzino"

#. module: mrp_unbuild_restore_origin
#: model:ir.model,name:mrp_unbuild_restore_origin.model_mrp_unbuild
msgid "Unbuild Order"
msgstr "Ordine di smontaggio"

#~ msgid ""
#~ "If enabled, the source location of the component stock move lines will be "
#~ "used as the destination location for the unbuild move lines."
#~ msgstr ""
#~ "Se abilitata, l'ubicazione origine delle righe movimento di magazzino del "
#~ "componente verrà usata come ubicazione destinazione per le righe di "
#~ "movimento non completate."

#~ msgid "Restore Raw Materials to Consumed Location"
#~ msgstr "Ripristina materiali grezzi nella ubicazioni utilizzate"
36 changes: 36 additions & 0 deletions mrp_unbuild_restore_origin/i18n/mrp_unbuild_restore_origin.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_unbuild_restore_origin
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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_unbuild_restore_origin
#: model:ir.model.fields,help:mrp_unbuild_restore_origin.field_mrp_unbuild__restore_rm_stock_in_origin_loc
msgid ""
"If selected, components will be returned to the same location they were "
"taken from during manufacturing."
msgstr ""

#. module: mrp_unbuild_restore_origin
#: model:ir.model.fields,field_description:mrp_unbuild_restore_origin.field_mrp_unbuild__restore_rm_stock_in_origin_loc
msgid "Return Components to Original Location"
msgstr ""

#. module: mrp_unbuild_restore_origin
#: model:ir.model,name:mrp_unbuild_restore_origin.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: mrp_unbuild_restore_origin
#: model:ir.model,name:mrp_unbuild_restore_origin.model_mrp_unbuild
msgid "Unbuild Order"
msgstr ""
2 changes: 2 additions & 0 deletions mrp_unbuild_restore_origin/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import mrp_unbuild
from . import stock_move_line
27 changes: 27 additions & 0 deletions mrp_unbuild_restore_origin/models/mrp_unbuild.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class MrpUnbuild(models.Model):
_inherit = "mrp.unbuild"

restore_rm_stock_in_origin_loc = fields.Boolean(
string="Return Components to Original Location",
help="If selected, components will be returned to the same location"
" they were taken from during manufacturing.",
)

def action_unbuild(self):
self.ensure_one()
if self.mo_id and self.restore_rm_stock_in_origin_loc:
self = self.with_context(exact_location=True)
return super().action_unbuild()

def _prepare_move_line_vals(self, move, origin_move_line, taken_quantity):
vals = super()._prepare_move_line_vals(move, origin_move_line, taken_quantity)
if self.env.context.get("exact_location"):
vals["location_id"] = origin_move_line.location_dest_id.id
vals["location_dest_id"] = origin_move_line.location_id.id
return vals
21 changes: 21 additions & 0 deletions mrp_unbuild_restore_origin/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# 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 _apply_putaway_strategy(self):
# Avoid changing locations if exact_location context is set
location_id = False
location_dest_id = False
if self.env.context.get("exact_location"):
location_id = self.location_id.id
location_dest_id = self.location_dest_id.id
super()._apply_putaway_strategy()
if location_id and location_dest_id:
self.location_id = location_id
self.location_dest_id = location_dest_id
return
3 changes: 3 additions & 0 deletions mrp_unbuild_restore_origin/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions mrp_unbuild_restore_origin/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [Quartile](https://www.quartile.co):
- Aung Ko Ko Lin
- Yoshi Tashiro
- Toshikimi Shigenobu
5 changes: 5 additions & 0 deletions mrp_unbuild_restore_origin/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module enhances the unbuild process of Manufacturing Orders by retaining
information from the original move lines.

- **Location Retention (Optional):** A boolean field is available to retain the original
source and destination locations of the move lines during the unbuild process, if needed.
4 changes: 4 additions & 0 deletions mrp_unbuild_restore_origin/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
If you want the components to be returned to the same locations they were originally
consumed from, enable the checkbox labeled **"Restore Components to Original Location"**
when creating the Unbuild Order. If this option is not enabled, Odoo will follow its standard
behavior.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading