Skip to content
Closed
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
85 changes: 85 additions & 0 deletions mrp_unbuild_lot_location/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
========================
MRP Unbuild Lot Location
========================

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

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

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

When a lot/serial number is selected on an unbuild order, this module
filters the available source locations to only those where the
lot/serial number is currently stocked.

If stock exists in a single location, it is automatically set as the
source location. If stock exists in multiple locations, the list is
narrowed down for the user to choose from. A warning is displayed if
no stock is found for the selected lot/serial number.

**Table of contents**

.. contents::
:local:

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_lot_location%0Aversion:%2016.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>`_:

* 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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions mrp_unbuild_lot_location/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2025 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
13 changes: 13 additions & 0 deletions mrp_unbuild_lot_location/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2025 Quartile
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "MRP Unbuild Lot Location",
"category": "Manufacturing",
"license": "AGPL-3",
"author": "Quartile, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"version": "16.0.1.0.0",
"depends": ["mrp"],
"data": ["views/mrp_unbuild_views.xml"],
"installable": True,
}
33 changes: 33 additions & 0 deletions mrp_unbuild_lot_location/i18n/ja.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_unbuild_lot_location
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-27 04:51+0000\n"
"PO-Revision-Date: 2026-02-27 04:51+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_unbuild_lot_location
#: model:ir.model.fields,field_description:mrp_unbuild_lot_location.field_mrp_unbuild__location_id_domain
msgid "Location Id Domain"
msgstr "ロケーションIDドメイン"

#. module: mrp_unbuild_lot_location
#. odoo-python
#: code:addons/mrp_unbuild_lot_location/models/mrp_unbuild.py:0
#, python-format
msgid "No stock found for lot/serial number %s."
msgstr "ロット/シリアル番号 %s の在庫がありません。"

#. module: mrp_unbuild_lot_location
#: model:ir.model,name:mrp_unbuild_lot_location.model_mrp_unbuild
msgid "Unbuild Order"
msgstr "解体オーダ"
1 change: 1 addition & 0 deletions mrp_unbuild_lot_location/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import mrp_unbuild
47 changes: 47 additions & 0 deletions mrp_unbuild_lot_location/models/mrp_unbuild.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2026 Quartile
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models


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

location_id_domain = fields.Many2many(
"stock.location",
compute="_compute_location_id_domain",
)

@api.depends("lot_id", "product_id")
def _compute_location_id_domain(self):
for record in self:
if record.lot_id:
quants = (
self.env["stock.quant"]
.sudo()
.search(
[
("product_id", "=", record.product_id.id),
("lot_id", "=", record.lot_id.id),
("quantity", ">", 0),
("location_id.usage", "in", ["internal", "transit"]),
]
)
)
record.location_id_domain = quants.mapped("location_id")
else:
record.location_id_domain = self.env["stock.location"]

@api.onchange("lot_id")
def _onchange_lot_id(self):
if not self.lot_id:
return
if len(self.location_id_domain) == 1:
self.location_id = self.location_id_domain
elif not self.location_id_domain:
return {
"warning": {
"message": _("No stock found for lot/serial number %s.")
% self.lot_id.name,
}
}
3 changes: 3 additions & 0 deletions mrp_unbuild_lot_location/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Quartile <https://www.quartile.co>`_:

* Toshikimi Shigenobu
8 changes: 8 additions & 0 deletions mrp_unbuild_lot_location/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
When a lot/serial number is selected on an unbuild order, this module
filters the available source locations to only those where the
lot/serial number is currently stocked.

If stock exists in a single location, it is automatically set as the
source location. If stock exists in multiple locations, the list is
narrowed down for the user to choose from. A warning is displayed if
no stock is found for the selected lot/serial number.
Loading
Loading