When we create new batch no on e.g. stock entry, purchase receipt…, user need to re-select item code on quick entry form. How to auto-fill item_code on batch quick entry form?
Any example that we can start with?
Tks
When we create new batch no on e.g. stock entry, purchase receipt…, user need to re-select item code on quick entry form. How to auto-fill item_code on batch quick entry form?
Any example that we can start with?
Tks
This doesn’t work…Any example?
frappe.ui.form.on("Purchase Invoice Item", {
refresh: function(frm, cdt, cdn) {
frm.fields_dict['items'].grid.get_field('batch_no').new_doc = function(frm, cdt, cdn){
var d = locals[cdt][cdn];
frappe.new_doc("Batch", {"item":d.item_code});
console.log(d.item_code);
};
}
});
As suggested in another reply this is not configurable for now. Git issue exists for the same. Please refer and add you use case on the github issue created.
https://github.com/frappe/erpnext/issues/8475
Hope this helps.
I had a similiar requirement… Here is my custom script…
frappe.ui.form.on("Purchase Invoice", "refresh", function(frm) {
frm.fields_dict['items'].grid.get_field('batch_no').new_doc = quick_entry_batch;
});
quick_entry_batch = function(doc, cdt, cdn){
var d = locals[cdt][cdn];
frappe._from_link = this;
quick_entry("Batch",
function(){},
{
"item":"testtes"
});
}
not working…it’s not even triggered
Copy paste this whole code in custom script of purchase invoice
hello Basawaraj_Savalagi,
same enhancement i am doning but not able to reached the ans
i use below code
frappe.ui.form.on(‘Purchase Receipt’,‘onload’,function(frm){
cur_frm.field_dict[‘item’].get_query = function(doc,cdt,cdn){
return{
filters:[
[“Item”,“Batch”,“in”,[“item_name”]]
]
}
}
});
Can anyone help me for the same
Thanks
Hello Basawaraj_Savalagi,
I use your script it will working for me but when i select multiple item in the purchase receipt and then i will create a new batch for the particular item then it will apply only first item means item[0],if i select the second item then it will also take the first item while creating the new batch so how this fix can u please help for the same.
Thanks
hey guys, i want the first_name and last_name field of health practitioner to be autofilled in quick entry employee form ? please reply as soon as possible
Any solution
I made it work with the following code:
$(document).ready(function() {
$(document).on('shown.bs.modal', '.modal', function() {
// Check if this is a Quick Entry dialog via frappe.quick_entry
if (frappe.quick_entry && frappe.quick_entry.dialog) {
let dialog = frappe.quick_entry.dialog;
if(dialog.doctype === "Item Price"){
// Find the field in the dialog and set its value, replace 'item_code' with your desired field
let field = dialog.get_field('item_code');
if (field) {
field.set_value('000432');
field.refresh();
} else {
console.log('Field "item_code" not found in this Quick Entry dialog.');
}
}
}
});
});
Paste it next to your other functions, make sure you replace "Item Price"
and 'item_code'
with your desired attributes and it should work.
I hope it will help the fellow