From b113349f31cfb91cdea2f3e864128052f5f69543 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Mon, 24 Sep 2018 14:30:07 +0530 Subject: [PATCH] minor fix for auto-opt-in for customer (#15483) --- erpnext/selling/doctype/customer/customer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index bd01ec9a91..d285704eb4 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -214,8 +214,9 @@ def get_loyalty_programs(doc): "ifnull(to_date, '2500-01-01')": [">=", today()]}) for loyalty_program in loyalty_programs: - customer_groups = [d.value for d in get_children("Customer Group", loyalty_program.customer_group)] - customer_territories = [d.value for d in get_children("Territory", loyalty_program.customer_territory)] + customer_groups = [d.value for d in get_children("Customer Group", loyalty_program.customer_group)] + [loyalty_program.customer_group] + customer_territories = [d.value for d in get_children("Territory", loyalty_program.customer_territory)] + [loyalty_program.customer_territory] + if (not loyalty_program.customer_group or doc.customer_group in customer_groups)\ and (not loyalty_program.customer_territory or doc.territory in customer_territories): lp_details.append(loyalty_program.name)