Skip to content

Commit

Permalink
fixup! [ADD] sale_loyalty_order_suggestion_multi_product: New module
Browse files Browse the repository at this point in the history
  • Loading branch information
pilarvargas-tecnativa committed Feb 28, 2024
1 parent 5cda8bf commit 4739d78
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ class SaleLoyaltyRewardWizard(models.TransientModel):

@api.depends("reward_ids", "selected_reward_id")
def _compute_multi_criteria(self):
self.multi_criteria = (
self.selected_reward_id.program_id.rule_ids.loyalty_criteria
== "multi_product"
self.multi_criteria = self.selected_reward_id.program_id.rule_ids.filtered(
lambda r: r.loyalty_criteria == "multi_product"
)

def _compute_loyalty_rule_line_ids(self):
Expand Down Expand Up @@ -58,9 +57,8 @@ def _compute_loyalty_rule_line_description(self):
return super()._compute_loyalty_rule_line_description()

def action_apply(self):
if (
self.selected_reward_id.program_id.rule_ids.loyalty_criteria
== "multi_product"
if self.selected_reward_id.program_id.rule_ids.filtered(
lambda r: r.loyalty_criteria == "multi_product"
):
if all(
line.units_to_include > 0 or line.units_included > 0
Expand Down

0 comments on commit 4739d78

Please sign in to comment.