Hi i am making naming series for the journal entries. So i am using the format naming series.
format:LT/JV/{posting_date}/{#####} and it is printing LT/JV/2024-01-16/00004. But how can i show it as LT/JV/2024/00004.
Basically i want to do indexing in posting date.
Your help will appreciated.
Thanks.
Hi @Manjunath_Sajjan
Actually the reason i am taking posting date is because i want to display the year of posting date in saved journal entries which can be 2022, 2023 or 2024.
By this it will display the year 2024.
for eg : LT/JV/2024/00007, LT/JV/2023/00007, LT/JV/2022/00007
I hope it explains what i want.
Thanks.
Hi @Mohammadali
i don’t want to display date and month. I only want to display the year
LT/JV/2024/00007, LT/JV/2023/00007, LT/JV/2022/00007. Like this.
thanks
Hy @Aditya_vig1
Use this script
frappe.ui.form.on('Doctype Name, {
validate:function(frm) {
let d = new Date(frm.doc.posting_date);
let year = d.getFullYear();
let ym = "LT-JV-" + year + "-.#####";
frm.set_value("naming_series", ym);
}
});
Thank You!
@Mohammadali thank you so much.
I used your code. But i think there are few things which i must do in doctype settings of journal entries.
What should be in the autoname field?
it will auto name by field for example
you create a field Label Date , set it as Data type , when you save your doctype there will be a field name stabled in your doctype so you can use as reference field:here your actual field name