mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
stock_reserve_rule: add dependency on stock_helper
To remove the duplicate implementation of StockLocation.is_sublocation_of()
This commit is contained in:
committed by
Sébastien Alix
parent
cc5d86da6d
commit
630ebc609f
@@ -7,7 +7,11 @@
|
||||
"author": "Camptocamp, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"category": "Stock Management",
|
||||
"depends": ["stock", "product_packaging_type"], # OCA/product-attribute
|
||||
"depends": [
|
||||
"stock",
|
||||
"stock_helper",
|
||||
"product_packaging_type", # OCA/product-attribute
|
||||
],
|
||||
"demo": [
|
||||
"demo/product_demo.xml",
|
||||
"demo/stock_location_demo.xml",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from . import stock_move
|
||||
from . import stock_location
|
||||
from . import stock_quant
|
||||
from . import stock_picking_type
|
||||
from . import stock_reserve_rule
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# 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)
|
||||
Reference in New Issue
Block a user