stock_reserve_rule: add dependency on stock_helper

To remove the duplicate implementation of
StockLocation.is_sublocation_of()
This commit is contained in:
Guewen Baconnier
2021-02-09 12:10:46 +01:00
committed by Sébastien Alix
parent cc5d86da6d
commit 630ebc609f
3 changed files with 5 additions and 16 deletions

View File

@@ -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",

View File

@@ -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

View File

@@ -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)