[SOLVED] ITEM Default value field formula

Hi to all,
I’d like to set the description or the item name as a concatanation of other fields and static strings, for example:

item_code + " STATICSTRING "+item_group

Is it possibile? If yes how can I do it?

Thanks
Alessandro

When would this be set? On Save?

It should be possible using a custom field and custom script. Here are the rough steps:

  1. Create a custom field for the Item DocType for the STATICSTRING element that you’ll use. You can place it and label it as you want (using the Customize DocType tool is very useful for this).
  2. Create a new Custom Script that looks for the save event and then updates the decscription field by grabbing the data in item_code, STATICSTRING and item_group.

More information on doing the client side script (through Custom Script) is here:

I try to write thi code in the section “Custom script” :

frappe.ui.form.on(“Item”, {
item_group: function(frm) {
frm.doc.description=frm.doc.item_group+" "+frm.doc.item_group;
}
});

But it doesn’t wokk
I’d like for example that on insert of item group the description value automtically change.
Is it possible?

Thanks
Alessandro

@alaurucci …try using cur_frm. instead of frm.

ok IT WORKS:

frappe.ui.form.on(“Item”, {
validate: function(frm) {
cur_frm.doc.description=frm.doc.item_group+" Aisi"+frm.doc.aisi+" Ø "+frm.doc.diametro+“x”+frm.doc.spessore+“x”+frm.doc.lunghezza;
}
});

Thanks