Adding expiry date from Batch to Delivery Note

Hi All,

We have been evaluating ERPnext to replace our existing ERP. Very impressed with ERPnext and having lots of hopes for betterment of our existing process with introduction of ERPnext.

Coming straight to my problem. I am trying to include expiry date from Batch to delivery note. I tried using hints from here:

https://frappe.io/kb/customization/fetch-custom-field-value-from-master-to-all-related-transactions

Via Setup → Customize → Customize Form, I tried linking Batch to “Delivery Note Item” Form and given expiry date as field name but no luck.

Can someone help?

Thanks.

In child table, “Options” thing does not work. Follow the second method, adding “Custom Script”.

Sorry for delay in response. But the solution of using “Custom Script” is not working for us. I tired custom fields for two different forms, one in Delivery Note Item for displaying item batch expiry date and the other one I tried is Sales Invoice item to get Delivery Note date from Delivery Note. But none of these are working.

I used custom script like below

cur_frm.add_fetch(‘delivery note’, ‘posting_date’, ‘delivery_note_date’)

And I tried changing various form type options. But nothing works, always in both the cases I just simply see a blank box for new field.

Similar problem here. I want to include the batch expiry date on the Delivery Note Report.

For that I created a custom field in the Delivery Note Item to save the batch expiry date. Then I created a Custom Script in the Delivery Note Item to fetch the value (when the item is selected) but it is not working.

Something like this:

cur_frm.add_fetch(‘batch_no’, ‘expiry_date’, ‘batch_no_expiry_date’)

Maybe is the script.

Any suggestions?

cur_frm.add_fetch doesn’t work for child tables.

Create a custom field in the Delivery Note Item for the batch expiration called expiry_date.

Add the following to the Delivery Note custom script (NOT DELIVERY NOTE ITEM)

I’ve not tested this, but it should work.

 
frappe.ui.form.on("Delivery Note Item", {
  batch_no: function(frm,cdt,cdn) {
    var expire = frappe.db.get_value("Batch",d.batch_no,expiry_date);
    frm.set_value("expiry_date", expire);
  }
});
1 Like

@cpurbaugh Thanks for the suggestion. I tried it but did not work.