fix: exclude zero-spend loyalty programs from auto-assignment fallback in res.partner
This commit is contained in:
parent
d7de65e2aa
commit
bbe7748aa1
@ -73,8 +73,16 @@ class ResPartner(models.Model):
|
||||
limit=1
|
||||
)
|
||||
if not lowest_program:
|
||||
# Fallback: pick the non-manual multi-level program with the lowest
|
||||
# minimum_spend. We require minimum_spend > 0 to exclude programs like
|
||||
# "Membership Direksi" that have no spend requirement (by-invitation only)
|
||||
# and would otherwise be picked first due to minimum_spend defaulting to 0.
|
||||
lowest_program = self.env['loyalty.program'].sudo().search(
|
||||
[('multi_level_membership', '=', True), ('manual_membership', '=', False)],
|
||||
[
|
||||
('multi_level_membership', '=', True),
|
||||
('manual_membership', '=', False),
|
||||
('minimum_spend', '>', 0),
|
||||
],
|
||||
order='minimum_spend asc',
|
||||
limit=1
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user