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
92 changes: 92 additions & 0 deletions repair_warehouse/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
=========================
Repair Warehouse Required
=========================

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

.. |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%2Frepair-lightgray.png?logo=github
:target: https://github.com/OCA/repair/tree/16.0/repair_warehouse
:alt: OCA/repair
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/repair-16-0/repair-16-0-repair_warehouse
: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/repair&target_branch=16.0
:alt: Try me on Runboat

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

This module adds a Warehouse field on Repair Orders to simplify repair
location selection in multi-warehouse environments.

When a repair location is chosen, the warehouse is automatically
determined and used to filter available locations. This makes location
selection clearer and avoids cross-warehouse mistakes.

A consistency rule ensures that the selected warehouse and repair
location always belong to the same warehouse.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/repair/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/repair/issues/new?body=module:%20repair_warehouse%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
-------

* ACSONE SA/NV

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

- Souheil Bejaoui [email protected]

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

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

|maintainer-sbejaoui|

This module is part of the `OCA/repair <https://github.com/OCA/repair/tree/16.0/repair_warehouse>`_ 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 repair_warehouse/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions repair_warehouse/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2026 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Repair Warehouse Required",
"summary": """This addon""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/repair",
"depends": ["repair"],
"data": ["views/repair_order.xml"],
"maintainers": ["sbejaoui"],
}
1 change: 1 addition & 0 deletions repair_warehouse/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import repair_order
55 changes: 55 additions & 0 deletions repair_warehouse/models/repair_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2026 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class RepairOrder(models.Model):

_inherit = "repair.order"

warehouse_id = fields.Many2one(
"stock.warehouse",
compute="_compute_warehouse_id",
store=True,
readonly=True,
help="Warehouse inferred from the repair location. You can override it manually, "
"but it must remain consistent with the selected location.",
states={"draft": [("readonly", False)]},
)
location_id = fields.Many2one(
domain="[('warehouse_id', '=', warehouse_id)]",
)

@api.depends("location_id")
def _compute_warehouse_id(self):
for rec in self:
if rec.location_id.warehouse_id:
rec.warehouse_id = rec.location_id.warehouse_id

@api.constrains("location_id", "warehouse_id")
def _check_warehouse_id(self):
for rec in self:
if (
not rec.location_id
or not rec.warehouse_id
or rec.location_id.usage == "customer"
):
continue
loc_wh = rec.location_id.warehouse_id
if loc_wh != rec.warehouse_id:
raise ValidationError(
_(
"Warehouse mismatch:\n"
"- Repair location: %(loc)s (warehouse: %(loc_wh)s)\n"
"- Repair order warehouse: %(order_wh)s\n\n"
"Please select a location belonging to the same warehouse, "
"or change the warehouse to match the location."
)
% {
"loc": rec.location_id.display_name,
"loc_wh": loc_wh.display_name,
"order_wh": rec.warehouse_id.display_name,
}
)
1 change: 1 addition & 0 deletions repair_warehouse/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Souheil Bejaoui <[email protected]>
9 changes: 9 additions & 0 deletions repair_warehouse/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This module adds a Warehouse field on Repair Orders to simplify
repair location selection in multi-warehouse environments.

When a repair location is chosen, the warehouse is automatically
determined and used to filter available locations. This makes
location selection clearer and avoids cross-warehouse mistakes.

A consistency rule ensures that the selected warehouse and
repair location always belong to the same warehouse.
Binary file added repair_warehouse/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading