Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Point of Sale - Coupons & Loyalty

Entity: loyalty.rule

Compute Method: _compute_valid_product_ids

Inputs Method Outputs
  • product_ids
  • product_category_id
  • product_tag_id
  • product_domain
domain_products = {}
for rule in self:
            if rule.product_ids or\
                rule.product_category_id or\
                rule.product_tag_id or\
                rule.product_domain not in ('[]', "[['sale_ok', '=', True]]"):
                domain = rule._get_valid_product_domain()
                domain = expression.AND([[('available_in_pos', '=', True)], domain])
                product_ids = domain_products.get(ustr(domain))
                if product_ids is None:
                    product_ids = self.env['product.product'].search(domain, order="id")
                    domain_products[ustr(domain)] = product_ids
                rule.valid_product_ids = product_ids
                rule.any_product = False
            else:
                rule.any_product = True
                rule.valid_product_ids = self.env['product.product']

Back to entity