fix: correctly show coupon code in transactions

This commit is contained in:
Joedeep Singh
2025-10-13 13:47:02 +00:00
parent 6933105261
commit cabb499a43
4 changed files with 11 additions and 3 deletions

View File

@@ -29,7 +29,8 @@
"address",
"column_break_monu",
"gstin",
"pan"
"pan",
"coupon_code"
],
"fields": [
{
@@ -173,6 +174,11 @@
"options": "currency",
"read_only": 1,
"reqd": 1
},
{
"fieldname": "coupon_code",
"fieldtype": "Data",
"label": "Coupon Code"
}
],
"index_web_pages_for_search": 1,
@@ -186,7 +192,7 @@
"link_fieldname": "payment"
}
],
"modified": "2025-10-13 15:25:56.127625",
"modified": "2025-10-13 18:52:13.542556",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Payment",

View File

@@ -117,6 +117,7 @@ def record_payment(
"discount_type": coupon_context.get("discount_type"),
"discount_percent": coupon_context.get("discount_percent"),
"discount_amount": coupon_context.get("discount_amount"),
"coupon_code": coupon_context.get("coupon_code"),
}
)
payment_doc.save(ignore_permissions=True)

View File

@@ -1017,6 +1017,7 @@ def apply_coupon(doctype, docname, code, country=None):
"gst_amount_formatted": fmt_money(gst_applied, 0, currency) if gst_applied else None,
"total_amount_formatted": fmt_money(final_amount, 0, currency),
"coupon": coupon.name,
"coupon_code": coupon.code,
"discount_type": coupon.discount_type,
"discount_percent": coupon.percent_off if coupon.discount_type == "Percent" else None,
}