diff options
| -rw-r--r-- | addons/website_sale/models/product.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index 79a5ebb02de..b1e440f3698 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -91,6 +91,7 @@ class ProductPricelist(models.Model): - Have its `website_id` set to current website (specific pricelist). - Have no `website_id` set and should be `selectable` (generic pricelist) or should have a `code` (generic promotion). + - Have no `company_id` or a `company_id` matching its website one. Note: A pricelist without a website_id, not selectable and without a code is a backend pricelist. @@ -98,13 +99,17 @@ class ProductPricelist(models.Model): Change in this method should be reflected in `_get_website_pricelists_domain`. """ self.ensure_one() + if self.company_id and self.company_id != self.env["website"].browse(website_id).company_id: + return False return self.website_id.id == website_id or (not self.website_id and (self.selectable or self.sudo().code)) def _get_website_pricelists_domain(self, website_id): ''' Check above `_is_available_on_website` for explanation. Change in this method should be reflected in `_is_available_on_website`. ''' + company_id = self.env["website"].browse(website_id).company_id.id return [ + '&', ('company_id', 'in', [False, company_id]), '|', ('website_id', '=', website_id), '&', ('website_id', '=', False), '|', ('selectable', '=', True), ('code', '!=', False), |
