Make the computation of product domain inheritable

This commit is contained in:
Alexis de Lattre
2016-06-18 17:29:49 +02:00
parent 25d8a50d3a
commit 6812d2e68b
2 changed files with 15 additions and 17 deletions

View File

@@ -46,17 +46,10 @@ class PurchaseSuggestionGenerate(models.TransientModel):
def generate_products_dict(self):
'''inherit the native method to use min_qty on product.product'''
ppo = self.env['product.product']
product_domain = []
products = {}
product_domain = self._prepare_product_domain()
if self.product_type == 'product':
product_domain.append(('type', '=', 'product'))
if self.categ_ids or self.seller_ids:
if self.categ_ids:
product_domain.append(
('categ_id', 'child_of', self.categ_ids.ids))
if self.seller_ids:
product_domain.append(
('seller_id', 'in', self.seller_ids.ids))
product_to_analyse = ppo.search(product_domain)
for product in product_to_analyse:
# We also want the missing product that have min_qty = 0