Skip to content

Commit

Permalink
feat: add loyalty points to Tx Data
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed May 31, 2024
1 parent 4f46dca commit bcd0bad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions erpnext/accounts/doctype/payment_request/payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ 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 = party.get("loyalty_program"), ref_doc.get("loyalty_points")
if lpm and lpp:
loyalty_points = [lpm, lpp]
else:
loyalty_points = None
return frappe._dict(
{
"amount": self.grand_total,
Expand All @@ -201,6 +207,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("loyalty_amount") or ref_doc.get("discount_amount"),
}
)

Expand Down

0 comments on commit bcd0bad

Please sign in to comment.