fix(payment_schedule): using show_alert instead of msgprint for non-selection of payment schedule (#53623)

(cherry picked from commit 086fea7cf0)

# Conflicts:
#	erpnext/public/js/controllers/transaction.js
This commit is contained in:
diptanilsaha
2026-03-19 12:29:28 +05:30
committed by Mergify
parent 9c243e8dd0
commit 323d0e6674

View File

@@ -419,6 +419,102 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
})
}
<<<<<<< HEAD
=======
if (!schedules.length) {
this.make_payment_request();
return;
}
if (!schedules || !schedules.length) {
frappe.msgprint(__("No pending payment schedules available."));
return;
}
const dialog = new frappe.ui.Dialog({
title: __("Select Payment Schedule"),
fields: [
{
fieldtype: "Table",
fieldname: "payment_schedules",
label: __("Payment Schedules"),
cannot_add_rows: true,
in_place_edit: false,
data: schedules,
fields: [
{
fieldtype: "Data",
fieldname: "name",
label: __("Schedule Name"),
read_only: 1,
},
{
fieldtype: "Data",
fieldname: "payment_term",
label: __("Payment Term"),
in_list_view: 1,
read_only: 1,
},
{
fieldtype: "Date",
fieldname: "due_date",
label: __("Due Date"),
in_list_view: 1,
read_only: 1,
},
{
fieldtype: "Currency",
fieldname: "payment_amount",
label: __("Amount"),
in_list_view: 1,
read_only: 1,
},
],
},
],
primary_action_label: __("Create Payment Request"),
primary_action: async () => {
const values = dialog.get_values();
const selected = values.payment_schedules.filter((r) => r.__checked);
if (!selected.length) {
frappe.show_alert({
message: __("Please select at least one schedule."),
indicator: "orange",
});
return;
}
console.log(selected);
dialog.hide();
let me = this;
const payment_request_type = ["Sales Order", "Sales Invoice"].includes(this.frm.doc.doctype)
? "Inward"
: "Outward";
const { message: pr_name } = await frappe.call({
method: "erpnext.accounts.doctype.payment_request.payment_request.make_payment_request",
args: {
dt: me.frm.doc.doctype,
dn: me.frm.doc.name,
recipient_id: me.frm.doc.contact_email,
payment_request_type: payment_request_type,
party_type: payment_request_type == "Outward" ? "Supplier" : "Customer",
party: payment_request_type == "Outward" ? me.frm.doc.supplier : me.frm.doc.customer,
party_name:
payment_request_type == "Outward"
? me.frm.doc.supplier_name
: me.frm.doc.customer_name,
reference_doctype: frm.doctype,
reference_name: frm.docname,
schedules: selected,
},
});
frappe.model.sync(pr_name);
frappe.set_route("Form", "Payment Request", pr_name.name);
},
});
dialog.show();
};
>>>>>>> 086fea7cf0 (fix(payment_schedule): using `show_alert` instead of `msgprint` for non-selection of payment schedule (#53623))
onload_post_render() {
if(this.frm.doc.__islocal && !(this.frm.doc.taxes || []).length
&& !this.frm.doc.__onload?.load_after_mapping) {