fix(payment entry): update payment order status

This commit is contained in:
Mangesh-Khairnar 2020-09-04 14:45:19 +05:30
parent 8d8af94182
commit e1889d0c1b

View File

@ -21,10 +21,15 @@ class PaymentOrder(Document):
if cancel: if cancel:
status = 'Initiated' status = 'Initiated'
ref_field = "status" if self.payment_order_type == "Payment Request" else "payment_order_status" if self.payment_order_type == "Payment Request":
ref_field = "status"
ref_doc_field = frappe.scrub(self.payment_order_type)
else:
ref_field = "payment_order_status"
ref_doc_field = "reference_name"
for d in self.references: for d in self.references:
frappe.db.set_value(self.payment_order_type, d.get(frappe.scrub(self.payment_order_type)), ref_field, status) frappe.db.set_value(self.payment_order_type, d.get(ref_doc_field), ref_field, status)
@frappe.whitelist() @frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs @frappe.validate_and_sanitize_search_inputs