mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
Merge pull request #44425 from frappe/mergify/bp/version-15-hotfix/pr-44302
fix: Minor Updates in `Payment Request` and `Payment Entry` (backport #44302)
This commit is contained in:
@@ -185,6 +185,10 @@ frappe.ui.form.on("Payment Entry", {
|
|||||||
filters: {
|
filters: {
|
||||||
reference_doctype: row.reference_doctype,
|
reference_doctype: row.reference_doctype,
|
||||||
reference_name: row.reference_name,
|
reference_name: row.reference_name,
|
||||||
|
company: doc.company,
|
||||||
|
status: ["!=", "Paid"],
|
||||||
|
outstanding_amount: [">", 0], // for compatibility with old data
|
||||||
|
docstatus: 1,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2877,6 +2877,7 @@ def get_open_payment_requests_for_references(references=None):
|
|||||||
.where(Tuple(PR.reference_doctype, PR.reference_name).isin(list(refs)))
|
.where(Tuple(PR.reference_doctype, PR.reference_name).isin(list(refs)))
|
||||||
.where(PR.status != "Paid")
|
.where(PR.status != "Paid")
|
||||||
.where(PR.docstatus == 1)
|
.where(PR.docstatus == 1)
|
||||||
|
.where(PR.outstanding_amount > 0) # to avoid old PRs with 0 outstanding amount
|
||||||
.orderby(Coalesce(PR.transaction_date, PR.creation), order=frappe.qb.asc)
|
.orderby(Coalesce(PR.transaction_date, PR.creation), order=frappe.qb.asc)
|
||||||
).run(as_dict=True)
|
).run(as_dict=True)
|
||||||
|
|
||||||
|
|||||||
@@ -987,12 +987,7 @@ def get_open_payment_requests_query(doctype, txt, searchfield, start, page_len,
|
|||||||
|
|
||||||
open_payment_requests = frappe.get_list(
|
open_payment_requests = frappe.get_list(
|
||||||
"Payment Request",
|
"Payment Request",
|
||||||
filters={
|
filters=filters,
|
||||||
**filters,
|
|
||||||
"status": ["!=", "Paid"],
|
|
||||||
"outstanding_amount": ["!=", 0], # for compatibility with old data
|
|
||||||
"docstatus": 1,
|
|
||||||
},
|
|
||||||
fields=["name", "grand_total", "outstanding_amount"],
|
fields=["name", "grand_total", "outstanding_amount"],
|
||||||
order_by="transaction_date ASC,creation ASC",
|
order_by="transaction_date ASC,creation ASC",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
from frappe import _
|
||||||
|
|
||||||
|
|
||||||
|
def get_data():
|
||||||
|
return {
|
||||||
|
"fieldname": "payment_request",
|
||||||
|
"internal_links": {
|
||||||
|
"Payment Entry": ["references", "payment_request"],
|
||||||
|
"Payment Order": ["references", "payment_order"],
|
||||||
|
},
|
||||||
|
"transactions": [
|
||||||
|
{"label": _("Payment"), "items": ["Payment Entry", "Payment Order"]},
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -1,19 +1,18 @@
|
|||||||
|
const INDICATORS = {
|
||||||
|
"Partially Paid": "orange",
|
||||||
|
Cancelled: "red",
|
||||||
|
Draft: "gray",
|
||||||
|
Failed: "red",
|
||||||
|
Initiated: "green",
|
||||||
|
Paid: "blue",
|
||||||
|
Requested: "green",
|
||||||
|
};
|
||||||
|
|
||||||
frappe.listview_settings["Payment Request"] = {
|
frappe.listview_settings["Payment Request"] = {
|
||||||
add_fields: ["status"],
|
add_fields: ["status"],
|
||||||
get_indicator: function (doc) {
|
get_indicator: function (doc) {
|
||||||
if (doc.status == "Draft") {
|
if (!doc.status || !INDICATORS[doc.status]) return;
|
||||||
return [__("Draft"), "gray", "status,=,Draft"];
|
|
||||||
}
|
return [__(doc.status), INDICATORS[doc.status], `status,=,${doc.status}`];
|
||||||
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"), "red", "status,=,Cancelled"];
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user