Merge pull request #17554 from surajshetty3416/fix-rename-account-develop
fix: Show "Merge Account" button only to users with write access
This commit is contained in:
commit
c24ace48a6
@ -42,15 +42,14 @@ frappe.ui.form.on('Account', {
|
||||
// show / hide convert buttons
|
||||
frm.trigger('add_toolbar_buttons');
|
||||
}
|
||||
frm.add_custom_button(__('Update Account Name / Number'), function () {
|
||||
frm.trigger("update_account_number");
|
||||
});
|
||||
}
|
||||
|
||||
if(!frm.doc.__islocal) {
|
||||
frm.add_custom_button(__('Merge Account'), function () {
|
||||
frm.trigger("merge_account");
|
||||
});
|
||||
if (frm.has_perm('write')) {
|
||||
frm.add_custom_button(__('Update Account Name / Number'), function () {
|
||||
frm.trigger("update_account_number");
|
||||
});
|
||||
frm.add_custom_button(__('Merge Account'), function () {
|
||||
frm.trigger("merge_account");
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
account_type: function (frm) {
|
||||
|
@ -268,7 +268,7 @@ def update_account_number(name, account_name, account_number=None):
|
||||
|
||||
new_name = get_account_autoname(account_number, account_name, account.company)
|
||||
if name != new_name:
|
||||
frappe.rename_doc("Account", name, new_name, ignore_permissions=1)
|
||||
frappe.rename_doc("Account", name, new_name, force=1)
|
||||
return new_name
|
||||
|
||||
@frappe.whitelist()
|
||||
@ -287,7 +287,7 @@ def merge_account(old, new, is_group, root_type, company):
|
||||
frappe.db.set_value("Account", new, "parent_account",
|
||||
frappe.db.get_value("Account", old, "parent_account"))
|
||||
|
||||
frappe.rename_doc("Account", old, new, merge=1, ignore_permissions=1)
|
||||
frappe.rename_doc("Account", old, new, merge=1, force=1)
|
||||
|
||||
return new
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user