From 630ebc609f1dd5ff227e35ba79b702a416b8cae5 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Tue, 9 Feb 2021 12:10:46 +0100 Subject: [PATCH] stock_reserve_rule: add dependency on stock_helper To remove the duplicate implementation of StockLocation.is_sublocation_of() --- stock_reserve_rule/__manifest__.py | 6 +++++- stock_reserve_rule/models/__init__.py | 1 - stock_reserve_rule/models/stock_location.py | 14 -------------- 3 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 stock_reserve_rule/models/stock_location.py diff --git a/stock_reserve_rule/__manifest__.py b/stock_reserve_rule/__manifest__.py index 7260fc480..f848698c8 100644 --- a/stock_reserve_rule/__manifest__.py +++ b/stock_reserve_rule/__manifest__.py @@ -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", diff --git a/stock_reserve_rule/models/__init__.py b/stock_reserve_rule/models/__init__.py index 47796b0c2..2dc701116 100644 --- a/stock_reserve_rule/models/__init__.py +++ b/stock_reserve_rule/models/__init__.py @@ -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 diff --git a/stock_reserve_rule/models/stock_location.py b/stock_reserve_rule/models/stock_location.py deleted file mode 100644 index 60caf1b3f..000000000 --- a/stock_reserve_rule/models/stock_location.py +++ /dev/null @@ -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)