fix: payment request status fixes
This commit is contained in:
parent
dbeb77e745
commit
0ec01d98d6
File diff suppressed because it is too large
Load Diff
@ -66,6 +66,8 @@ class PaymentRequest(Document):
|
|||||||
if self.payment_request_type == 'Outward':
|
if self.payment_request_type == 'Outward':
|
||||||
self.db_set('status', 'Initiated')
|
self.db_set('status', 'Initiated')
|
||||||
return
|
return
|
||||||
|
elif self.payment_request_type == 'Inward':
|
||||||
|
self.db_set('status', 'Requested')
|
||||||
|
|
||||||
send_mail = self.payment_gateway_validation()
|
send_mail = self.payment_gateway_validation()
|
||||||
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
|
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
|
||||||
@ -422,10 +424,14 @@ def make_status_as_paid(doc, method):
|
|||||||
"docstatus": 1})
|
"docstatus": 1})
|
||||||
|
|
||||||
if payment_request_name:
|
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)
|
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')
|
doc.db_set('status', 'Paid')
|
||||||
frappe.db.commit()
|
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):
|
def get_dummy_message(doc):
|
||||||
return frappe.render_template("""{% if doc.contact_person -%}
|
return frappe.render_template("""{% if doc.contact_person -%}
|
||||||
|
|||||||
@ -4,14 +4,20 @@ frappe.listview_settings['Payment Request'] = {
|
|||||||
if(doc.status == "Draft") {
|
if(doc.status == "Draft") {
|
||||||
return [__("Draft"), "darkgrey", "status,=,Draft"];
|
return [__("Draft"), "darkgrey", "status,=,Draft"];
|
||||||
}
|
}
|
||||||
|
if(doc.status == "Requested") {
|
||||||
|
return [__("Requested"), "green", "status,=,Requested"];
|
||||||
|
}
|
||||||
else if(doc.status == "Initiated") {
|
else if(doc.status == "Initiated") {
|
||||||
return [__("Initiated"), "green", "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") {
|
else if(doc.status == "Paid") {
|
||||||
return [__("Paid"), "blue", "status,=,Paid"];
|
return [__("Paid"), "blue", "status,=,Paid"];
|
||||||
}
|
}
|
||||||
else if(doc.status == "Cancelled") {
|
else if(doc.status == "Cancelled") {
|
||||||
return [__("Cancelled"), "orange", "status,=,Cancelled"];
|
return [__("Cancelled"), "red", "status,=,Cancelled"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user