Hi Everyone,
Is there any way to remove or hide these options ? mentioned in the image.
User is able to see these options in a purchase invoice, we dont want these, how can i achieve that ?
Script or something else ?
Doctype → Purchase invoice
Thank You
avc
July 26, 2024, 9:16am
2
1 Like
Hi @avc
I tried this -
frappe.ui.form.on('Purchase Invoice', {
refresh(frm) {
setTimeout(() => {
frm.remove_button('Create');
frm.remove_button('Preview');
frm.remove_button('Get Items From');
}, 10);
}
});
How can i get the button name ?
Thank You
avc
July 26, 2024, 10:34am
5
Check this:
frm.remove_custom_button('Close', 'Status');
Where Status
is the button and Close
is the action. Do it for each action inside button, and button should dissapear.
Hope this helps.
Hi, @avc
I tried but no luck maybe something wrong with button name etc.
frappe.ui.form.on('Purchase Invoice', {
refresh(frm) {
setTimeout(() => {
frm.remove_custom_button('Close', 'Create');
frm.remove_custom_button('Close', 'Preview');
frm.remove_custom_button('Close', 'Get Items From');
}, 10);
}
});
avc
July 26, 2024, 10:21pm
7
Hi @rs115199789 :
This is the right way
frappe.ui.form.on('Purchase Invoice', {
refresh(frm) {
setTimeout(() => {
frm.remove_custom_button("Return / Debit Note", 'Create');
frm.remove_custom_button('Purchase Receipt', 'Create');
frm.remove_custom_button('Accounting Ledger', 'View');
frm.remove_custom_button('Stock Ledger', 'View');
frm.remove_custom_button('UnReconcile', 'Actions');
}, 1000);
}
});
Hope this helps.
1 Like
I don’t know why but it’s still not working. M i doing something wrong ?
or you want any additional information from me.
Thank You for your time and Patience .
hi @rs115199789 why you want to remove this option this option is only visible to admins i think so if you dont want other user to see this just change their roles…
avc
July 27, 2024, 8:26am
10
Hi @rs115199789 :
Can you share screenshot from your client script?
Maybe is not enabled?
Hi @rs115199789
Try this
frappe.ui.form.on(‘Purchase Invoice’, {
refresh(frm) {
frm.remove_custom_button(“Return / Debit Note”, ‘Create’);
frm.remove_custom_button(‘Purchase Receipt’, ‘Create’);
frm.remove_custom_button(‘Accounting Ledger’, ‘View’);
frm.remove_custom_button(‘Stock Ledger’, ‘View’);
frm.remove_custom_button(‘UnReconcile’, ‘Actions’);
frm.removr_custom_buton(‘Payment Request’,‘Create’)
}
});
avc
July 27, 2024, 9:29am
13
Hi @rs115199789 :
frappe.ui.form.on('Purchase Invoice', {
refresh(frm) {
console.log("before timer")
setTimeout(() => {
console.log("into timer")
frm.remove_custom_button("Return / Debit Note", 'Create');
frm.remove_custom_button('Purchase Receipt', 'Create');
frm.remove_custom_button('Accounting Ledger', 'View');
frm.remove_custom_button('Stock Ledger', 'View');
frm.remove_custom_button('UnReconcile', 'Actions');
}, 1000);
}
});
Check browser console … can you share what is showing?
1 Like
Hi @avc
Sir still same issue, here is the ss
frappe.ui.form.on('Purchase Invoice', {
refresh(frm) {
console.log("before timer");
setTimeout(() => {
console.log("into timer");
frm.remove_custom_button("Return / Debit Note", 'Create');
frm.remove_custom_button('Purchase Receipt', 'Create');
frm.remove_custom_button('Accounting Ledger', 'View');
frm.remove_custom_button('Stock Ledger', 'View');
frm.remove_custom_button('UnReconcile', 'Actions');
}, 1000);
}
});
@rs115199789
verify once bcz it working my side
frappe.ui.form.on('Purchase Invoice', {
refresh(frm) {
frm.remove_custom_button("Return / Debit Note", 'Create');
frm.remove_custom_button('Purchase Receipt', 'Create');
frm.remove_custom_button('Accounting Ledger', 'View');
frm.remove_custom_button('Stock Ledger', 'View');
frm.remove_custom_button('UnReconcile', 'Actions');
frm.removr_custom_buton('Payment Request','Create')
}
});
1 Like
avc
July 27, 2024, 9:43am
18
Hi @rs115199789
Have you other client scripts for Purchase Invoice?
If you are working on slow environment, try to increment the timeout value, try 10000 instead 1000 …
Share all actions avaliable on each button : Create, Preview, Get Items From, Actions
Hi, @avc
Here are the available options
Create
Quality Inspection(s)
Payment Request
Preview
Accounting Ledger
Get items from
Accounting Ledger
And yes i do have multiple client scripts for the Purchase invoice doctype.
1 - To hide file ico
2- Adjust and freeze side pane and action button when scroll down
and 2/3 more.
can you submit the invoice and then check again ?
Thank You