mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-07 15:25:19 +00:00
fix: hide payment and payment request buttons based on permissions in invoices and orders (backport #53920) (#54736)
Co-authored-by: Sakthivel Murugan S <129778327+ssakthivelmurugan@users.noreply.github.com> Co-authored-by: ravibharathi656 <ravibharathi656@gmail.com> fix: hide payment and payment request buttons based on permissions in invoices and orders (#53920)
This commit is contained in:
@@ -115,7 +115,12 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doc.docstatus == 1 && doc.outstanding_amount != 0 && !doc.on_hold) {
|
if (
|
||||||
|
doc.docstatus == 1 &&
|
||||||
|
doc.outstanding_amount != 0 &&
|
||||||
|
!doc.on_hold &&
|
||||||
|
frappe.model.can_create("Payment Entry")
|
||||||
|
) {
|
||||||
this.frm.add_custom_button(__("Payment"), () => this.make_payment_entry(), __("Create"));
|
this.frm.add_custom_button(__("Payment"), () => this.make_payment_entry(), __("Create"));
|
||||||
this.frm.page.set_inner_btn_group_as_primary(__("Create"));
|
this.frm.page.set_inner_btn_group_as_primary(__("Create"));
|
||||||
}
|
}
|
||||||
@@ -130,7 +135,13 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doc.docstatus == 1 && doc.outstanding_amount > 0 && !cint(doc.is_return) && !doc.on_hold) {
|
if (
|
||||||
|
doc.docstatus == 1 &&
|
||||||
|
doc.outstanding_amount > 0 &&
|
||||||
|
!cint(doc.is_return) &&
|
||||||
|
!doc.on_hold &&
|
||||||
|
frappe.boot.user.in_create.includes("Payment Request")
|
||||||
|
) {
|
||||||
this.frm.add_custom_button(
|
this.frm.add_custom_button(
|
||||||
__("Payment Request"),
|
__("Payment Request"),
|
||||||
function () {
|
function () {
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
|
|||||||
erpnext.accounts.ledger_preview.show_stock_ledger_preview(this.frm);
|
erpnext.accounts.ledger_preview.show_stock_ledger_preview(this.frm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doc.docstatus == 1 && doc.outstanding_amount != 0) {
|
if (doc.docstatus == 1 && doc.outstanding_amount != 0 && frappe.model.can_create("Payment Entry")) {
|
||||||
this.frm.add_custom_button(__("Payment"), () => this.make_payment_entry(), __("Create"));
|
this.frm.add_custom_button(__("Payment"), () => this.make_payment_entry(), __("Create"));
|
||||||
this.frm.page.set_inner_btn_group_as_primary(__("Create"));
|
this.frm.page.set_inner_btn_group_as_primary(__("Create"));
|
||||||
}
|
}
|
||||||
@@ -135,13 +135,15 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (doc.outstanding_amount > 0) {
|
if (doc.outstanding_amount > 0) {
|
||||||
this.frm.add_custom_button(
|
if (frappe.boot.user.in_create.includes("Payment Request")) {
|
||||||
__("Payment Request"),
|
this.frm.add_custom_button(
|
||||||
function () {
|
__("Payment Request"),
|
||||||
me.make_payment_request_with_schedule();
|
function () {
|
||||||
},
|
me.make_payment_request_with_schedule();
|
||||||
__("Create")
|
},
|
||||||
);
|
__("Create")
|
||||||
|
);
|
||||||
|
}
|
||||||
this.frm.add_custom_button(
|
this.frm.add_custom_button(
|
||||||
__("Invoice Discounting"),
|
__("Invoice Discounting"),
|
||||||
this.make_invoice_discounting.bind(this),
|
this.make_invoice_discounting.bind(this),
|
||||||
|
|||||||
@@ -416,7 +416,11 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends (
|
|||||||
__("Create")
|
__("Create")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (flt(doc.per_billed) < 100 && doc.status != "Delivered") {
|
if (
|
||||||
|
frappe.model.can_create("Payment Entry") &&
|
||||||
|
flt(doc.per_billed) < 100 &&
|
||||||
|
doc.status != "Delivered"
|
||||||
|
) {
|
||||||
this.frm.add_custom_button(
|
this.frm.add_custom_button(
|
||||||
__("Payment"),
|
__("Payment"),
|
||||||
() => this.make_payment_entry(),
|
() => this.make_payment_entry(),
|
||||||
@@ -424,7 +428,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flt(doc.per_billed) < 100) {
|
if (flt(doc.per_billed) < 100 && frappe.boot.user.in_create.includes("Payment Request")) {
|
||||||
this.frm.add_custom_button(
|
this.frm.add_custom_button(
|
||||||
__("Payment Request"),
|
__("Payment Request"),
|
||||||
function () {
|
function () {
|
||||||
|
|||||||
@@ -1162,11 +1162,13 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
|
|||||||
}
|
}
|
||||||
// payment request
|
// payment request
|
||||||
if (flt(doc.per_billed) < 100 + frappe.boot.sysdefaults.over_billing_allowance) {
|
if (flt(doc.per_billed) < 100 + frappe.boot.sysdefaults.over_billing_allowance) {
|
||||||
this.frm.add_custom_button(
|
if (frappe.boot.user.in_create.includes("Payment Request")) {
|
||||||
__("Payment Request"),
|
this.frm.add_custom_button(
|
||||||
() => this.make_payment_request_with_schedule(),
|
__("Payment Request"),
|
||||||
__("Create")
|
() => this.make_payment_request_with_schedule(),
|
||||||
);
|
__("Create")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (frappe.model.can_create("Payment Entry")) {
|
if (frappe.model.can_create("Payment Entry")) {
|
||||||
this.frm.add_custom_button(
|
this.frm.add_custom_button(
|
||||||
|
|||||||
Reference in New Issue
Block a user