mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
Example of configuration: Rule location: Stock Removal rule 1: Stock/Zone1 Removal rule 2: Stock/Zone2 Reservation of a stock move with Stock/Zone2 as source location. Previously, it would reserve in Stock/Zone1. Now, it will never be allowed to reserve in Stock/Zone1. A warning message was added previously to warn the user about potential issues, which is now obsolete so I removed it.
15 lines
545 B
Python
15 lines
545 B
Python
# Copyright 2019 Camptocamp SA
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
from odoo import models
|
|
|
|
|
|
class StockLocation(models.Model):
|
|
_inherit = "stock.location"
|
|
|
|
def is_sublocation_of(self, others):
|
|
"""Return True if self is a sublocation of at least one other"""
|
|
self.ensure_one()
|
|
# Efficient way to verify that the current location is
|
|
# below one of the other location without using SQL.
|
|
return any(self.parent_path.startswith(other.parent_path) for other in others)
|