fix: payment request status fixes

This commit is contained in:
Saqib Ansari 2020-03-28 16:11:23 +05:30
parent dbeb77e745
commit 0ec01d98d6
3 changed files with 346 additions and 1507 deletions

File diff suppressed because it is too large Load Diff

View File

@ -66,6 +66,8 @@ class PaymentRequest(Document):
if self.payment_request_type == 'Outward':
self.db_set('status', 'Initiated')
return
elif self.payment_request_type == 'Inward':
self.db_set('status', 'Requested')
send_mail = self.payment_gateway_validation()
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
@ -422,10 +424,14 @@ def make_status_as_paid(doc, method):
"docstatus": 1})
if payment_request_name:
outstanding_amt = frappe.get_value(ref.reference_doctype, ref.reference_name, 'outstanding_amount')
doc = frappe.get_doc("Payment Request", payment_request_name)
if doc.status != "Paid":
if doc.status != "Paid" and outstanding_amt <= 0:
doc.db_set('status', 'Paid')
frappe.db.commit()
elif doc.status != "Partially Paid" and outstanding_amt != doc.grand_total:
doc.db_set('status', 'Partially Paid')
frappe.db.commit()
def get_dummy_message(doc):
return frappe.render_template("""{% if doc.contact_person -%}

View File

@ -4,14 +4,20 @@ frappe.listview_settings['Payment Request'] = {
if(doc.status == "Draft") {
return [__("Draft"), "darkgrey", "status,=,Draft"];
}
if(doc.status == "Requested") {
return [__("Requested"), "green", "status,=,Requested"];
}
else if(doc.status == "Initiated") {
return [__("Initiated"), "green", "status,=,Initiated"];
}
else if(doc.status == "Partially Paid") {
return [__("Partially Paid"), "orange", "status,=,Partially Paid"];
}
else if(doc.status == "Paid") {
return [__("Paid"), "blue", "status,=,Paid"];
}
else if(doc.status == "Cancelled") {
return [__("Cancelled"), "orange", "status,=,Cancelled"];
return [__("Cancelled"), "red", "status,=,Cancelled"];
}
}
}