From 0796d71a6d7ba7bae307ae7e2ef66c2cefd1ef4c Mon Sep 17 00:00:00 2001 From: David Date: Sun, 2 Jun 2024 11:27:33 +0200 Subject: [PATCH] feat: separate lp and discount --- .../doctype/payment_request/payment_request.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index 5da82c00edb3..8824e744bc26 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -194,9 +194,13 @@ def get_tx_data(self): else: address = {} ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name) - lpm, lpp = party.get("loyalty_program"), ref_doc.get("loyalty_points") - if lpm and lpp: - loyalty_points = [lpm, lpp] + lpm, lpp, lpa = ( + party.get("loyalty_program"), + ref_doc.get("loyalty_points"), + ref_doc.get("loyalty_amount"), + ) + if lpm and lpp and lpa: + loyalty_points = [lpm, lpp, lpa] else: loyalty_points = None return frappe._dict( @@ -208,7 +212,7 @@ def get_tx_data(self): "payer_contact": contact, "payer_address": address, "loyalty_points": loyalty_points, - "discount_amount": ref_doc.get("loyalty_amount") or ref_doc.get("discount_amount"), + "discount_amount": ref_doc.get("discount_amount"), } )