diff --git a/addons/product/models/product_pricelist.py b/addons/product/models/product_pricelist.py index 3f865ba1637..e6aa593f0bc 100644 --- a/addons/product/models/product_pricelist.py +++ b/addons/product/models/product_pricelist.py @@ -307,8 +307,11 @@ class Pricelist(models.Model): return pricelist.get_products_price( list(zip(**products_by_qty_by_partner))) - def _get_partner_pricelist_multi_search_domain_hook(self): - return [('active', '=', True)] + def _get_partner_pricelist_multi_search_domain_hook(self, company_id): + return [ + ('active', '=', True), + ('company_id', 'in', [company_id, False]), + ] def _get_partner_pricelist_multi_filter_hook(self): return self.filtered('active') @@ -331,10 +334,11 @@ class Pricelist(models.Model): # `partner_ids` might be ID from inactive uers. We should use active_test # as we will do a search() later (real case for website public user). Partner = self.env['res.partner'].with_context(active_test=False) + company_id = company_id or self.env.company.id Property = self.env['ir.property'].with_company(company_id) Pricelist = self.env['product.pricelist'] - pl_domain = self._get_partner_pricelist_multi_search_domain_hook() + pl_domain = self._get_partner_pricelist_multi_search_domain_hook(company_id) # if no specific property, try to find a fitting pricelist result = Property.get_multi('property_product_pricelist', Partner._name, partner_ids) diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index 15078bb4b18..ff61753a794 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -65,8 +65,8 @@ class ProductPricelist(models.Model): self.clear_cache() return res - def _get_partner_pricelist_multi_search_domain_hook(self): - domain = super(ProductPricelist, self)._get_partner_pricelist_multi_search_domain_hook() + def _get_partner_pricelist_multi_search_domain_hook(self, company_id): + domain = super(ProductPricelist, self)._get_partner_pricelist_multi_search_domain_hook(company_id) website = ir_http.get_request_website() if website: domain += self._get_website_pricelists_domain(website.id)