Add "FREE STOCK" to item detail in stock docs


Can someone please help me with this. The scenario is as follows: supplier brings free stock which we can capture at 0.00 Rate while our price list rate maintains the last buying price. This works perfectly; what we need to do now is customize the POrder Item and PReceipt Item forms to show a “FREE STOCK”: text whenever the rate is 0.00 so can someone tell me how to use an eval statement in “Depends On” field in the customize form something along the lines of eval:doc.item.price == 0; as such the “Free Stock” text shows beside this item only if the rate is 0.



Use this:

frappe.ui.form.on(“Purchase Receipt Detail”,“rate”, function(frm, cdt, cdn) {
var d =locals[cdt][cdn]
var v_item=frappe.get_ doc(cdt,cdn);
if(d.rate ==0){
frappe.model.set_value(“Purchase Receipt Items”, d.v_item, “item_code”, “Your Free Stock Item Code”);

Hello Sir; thanks for this, could you please tell me where to add this code? Also please note that this should apply automatically for each free item in a PO or PR document.

Thanks for the quick response.

Noetico.IT Corporate Mail

Please where do I add this? in the options field of the form field or as a custom script. Thanks.