I am using erpnext v14.33.1, if i am not mistaken:
I am trying to use the time tag in notification mails and it sort of works, but the time is displayed in a very weird way. It should be in the format hh:mm:ss, but it gets something like hh:mm:ss:ms etc. Is this some kind of bug? Or any way how i can fix this?
And another thing I am trying to figure out, I dont want to open a whole new post for it
How can I include a âView this content in browserâ button for attached documents in notification mails, its possible for general mails with the âSend document web view link in emailâ button in the system settings, but I want to achieve the same with notification mails and wasnt able to figure it out until now. The link should be in this format: https://erp.domain.com/Sales%20Order/SAL-ORD-2023-00001?format=Standard&key=anykey
If anyone could help me, that would be great. Thank you!!
frappe.ui.form.on('Your Doctype', {
your_field: function(frm) {
var time_str = frm.doc.your_field; // Replace "your_field" with your actual field name
var formatted_time = moment(time_str, ["HH:mm:ss"]).format("HH:mm:ss"); // Replace "HH:mm:ss" with your desired format
frm.set_value('your_field', formatted_time); // Replace "your_field" with your actual field name
}
});
Since i wasnt completely sure i tried frm.set_value(âdoc.timeâ, formatted_time); and frm.set_value(âtimeâ, formatted_time);, but both hasnt changed anything to the time format. I am probably doing something wrong, any idea?
Replace your_field with your actual field name
Also try storing the value in a separate field (perhaps a virtual docfield) or try logging to the console.
If your case is purely for print format/notification then just format the time through Jinja instead.
I tried this: â<a href="{{frappe.utils.get_url_to_form(doc.doctype, doc.name)}}">{{doc.name}}</a>â, but it will link to the document without a key, so you cant access it without being logged in