diff --git a/addons/product/models/product_pricelist.py b/addons/product/models/product_pricelist.py index c2beda3501a..df89dced81c 100644 --- a/addons/product/models/product_pricelist.py +++ b/addons/product/models/product_pricelist.py @@ -219,12 +219,15 @@ class Pricelist(models.Model): # Split methods to ease (community) overrides def _get_applicable_rules(self, products, date, **kwargs): self and self.ensure_one() # self is at most one record + if not self: + return self.env['product.pricelist.item'] + # Do not filter out archived pricelist items, since it means current pricelist is also archived # We do not want the computation of prices for archived pricelist to always fallback on the Sales price # because no rule was found (thanks to the automatic orm filtering on active field) return self.env['product.pricelist.item'].with_context(active_test=False).search( self._get_applicable_rules_domain(products=products, date=date, **kwargs) - ) + ).with_context(self.env.context) def _get_applicable_rules_domain(self, products, date, **kwargs): self and self.ensure_one() # self is at most one record