mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
fix: permission based revision of budget
This commit is contained in:
@@ -4,16 +4,6 @@ frappe.provide("erpnext.accounts.dimensions");
|
|||||||
|
|
||||||
frappe.ui.form.on("Budget", {
|
frappe.ui.form.on("Budget", {
|
||||||
onload: function (frm) {
|
onload: function (frm) {
|
||||||
frm.set_query("account", "accounts", function () {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
company: frm.doc.company,
|
|
||||||
report_type: "Profit and Loss",
|
|
||||||
is_group: 0,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
frm.set_query("monthly_distribution", function () {
|
frm.set_query("monthly_distribution", function () {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@@ -30,17 +20,27 @@ frappe.ui.form.on("Budget", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function (frm) {
|
refresh: async function (frm) {
|
||||||
frm.trigger("toggle_reqd_fields");
|
frm.trigger("toggle_reqd_fields");
|
||||||
|
|
||||||
if (!frm.doc.__islocal && frm.doc.docstatus == 1) {
|
if (!frm.doc.__islocal && frm.doc.docstatus == 1) {
|
||||||
frm.add_custom_button(
|
let exception_role = await frappe.db.get_value(
|
||||||
__("Revise Budget"),
|
"Company",
|
||||||
function () {
|
frm.doc.company,
|
||||||
frm.events.revise_budget_action(frm);
|
"exception_budget_approver_role"
|
||||||
},
|
|
||||||
__("Actions")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const role = exception_role.message.exception_budget_approver_role;
|
||||||
|
|
||||||
|
if (role && frappe.user.has_role(role)) {
|
||||||
|
frm.add_custom_button(
|
||||||
|
__("Revise Budget"),
|
||||||
|
function () {
|
||||||
|
frm.events.revise_budget_action(frm);
|
||||||
|
},
|
||||||
|
__("Actions")
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -184,6 +184,7 @@
|
|||||||
"options": "\nStop\nWarn\nIgnore"
|
"options": "\nStop\nWarn\nIgnore"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"default": "BUDGET-.########",
|
||||||
"fieldname": "naming_series",
|
"fieldname": "naming_series",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Series",
|
"label": "Series",
|
||||||
@@ -308,7 +309,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-11-17 17:38:27.759355",
|
"modified": "2025-11-19 17:00:00.648224",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Budget",
|
"name": "Budget",
|
||||||
|
|||||||
Reference in New Issue
Block a user