diff --git a/exceptions.py b/exceptions.py index 2933239c6c..de1ece4150 100644 --- a/exceptions.py +++ b/exceptions.py @@ -8,6 +8,10 @@ class AssignError(UserError): pass +class MoveValidationError(ValidationError): + pass + + class LocationValidationError(ValidationError): pass diff --git a/product.py b/product.py index a1836581b2..d0e6052b35 100644 --- a/product.py +++ b/product.py @@ -285,13 +285,16 @@ class Product(StockMixin, object, metaclass=PoolMeta): ('state', '=', 'done'), ] + @classmethod + def _domain_storage_quantity(cls): + "Returns the domain for locations to use in cost computation" + return [('type', '=', 'storage')] + def _get_storage_quantity(self, date=None): pool = Pool() Location = pool.get('stock.location') - locations = Location.search([ - ('type', '=', 'storage'), - ]) + locations = Location.search(self._domain_storage_quantity()) if not date: date = datetime.date.today() location_ids = [l.id for l in locations]