diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index 6d43d8851d2c..8824e744bc26 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -193,6 +193,16 @@ def get_tx_data(self): address = frappe.get_doc("Address", party.customer_primary_address).as_dict() else: address = {} + ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name) + 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( { "amount": self.grand_total, @@ -201,6 +211,8 @@ def get_tx_data(self): "reference_docname": self.name, "payer_contact": contact, "payer_address": address, + "loyalty_points": loyalty_points, + "discount_amount": ref_doc.get("discount_amount"), } )