Hello,
I’ve noticed a small but annoying issue:
When inserting a date (i.e. {{ due_date }}) in a standard reply, the date format chosen in Setup/Standard settings is not respected in the email created.
The format in the email should be dd-mm-yyyy but appears as yyyy-mm-dd.
Is there any way to fix that?
Thanks in advance for your prompt reply.
Francois
{{ frappe.format_date(due_date} }}
or
{{ doc.get_formatted(due_date) }}
Thanks, Rushabh.
I’ll try that asap.
Would you also have a solution to pull out first name only for the email contact? I’m currently using {{ contact_display }} but that results in « First Name + Last name » and I prefer it to be first name only.
Thanks again,
Francois
Francois De Man
Operations Manager • 1wAVe sprl
+32 478 56 64 82 <tel:+32 478 56 64 82>
Hello again, Rushabh.
The first suggestion doesn’t format due date correctly. It comes out as « November 17, 2017 » instead of 17/11/2017.
The second causes 2 system errors and doesn’t populate.
Any suggestion?
Francois
Francois De Man
Operations Manager • 1wAVe sprl
+32 478 56 64 82 <tel:+32 478 56 64 82>
Any news on this please?
Thanks in advance,
Francois
Francois De Man
Operations Manager • 1wAVe sprl
+32 478 56 64 82 <tel:+32 478 56 64 82>
Hi francoisDeMan
I think you should check again.
/desk#Form/System Settings => Date Format = dd-mm-yyyy ?
Hello Vincent,
This has been checked and double checked.
Setup / System Settings / Date & Number Format / Date Format is set to dd-mm-yyyy.
Thanks in advance for your assistance,
Francois
Francois De Man
Operations Manager • 1wAVe sprl
+32 478 56 64 82 <tel:+32 478 56 64 82>
Hi francoisDeMan
Or you can try this
{{frappe.utils.formatdate(doc.due_date, "dd-MM-yyyy")}}
Hi vincent,
Just tried what u suggested and got 2 server errors (see below).
Thanks in advance for your assistance,
Francois
Something went wrong
Server Error: Please check your server logs or contact tech support.
Traceback (most recent call last):
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/app.py”, line 57, in application
response = frappe.handler.handle()
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/init.py”, line 935, in call
return fn(*args, **newargs)
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/email/doctype/standard_reply/standard_reply.py”, line 22, in get_standard_reply
“message” : frappe.render_template(standard_reply.response, doc)}
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/utils/jinja.py”, line 69, in render_template
return get_jenv().from_string(template).render(context)
File “/home/frappe/benches/bench-2017-11-28/env/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/benches/bench-2017-11-28/env/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “”, line 4, in top-level template code
File “/home/frappe/benches/bench-2017-11-28/env/lib/python2.7/site-packages/jinja2/environment.py”, line 430, in getattr
return getattr(obj, attribute)
UndefinedError: ‘doc’ is undefined
Report this issue
Server Error: Please check your server logs or contact tech support.
Traceback (most recent call last):
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/app.py”, line 57, in application
response = frappe.handler.handle()
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/init.py”, line 935, in call
return fn(*args, **newargs)
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/email/doctype/standard_reply/standard_reply.py”, line 22, in get_standard_reply
“message” : frappe.render_template(standard_reply.response, doc)}
File “/home/frappe/benches/bench-2017-11-28/apps/frappe/frappe/utils/jinja.py”, line 69, in render_template
return get_jenv().from_string(template).render(context)
File “/home/frappe/benches/bench-2017-11-28/env/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/benches/bench-2017-11-28/env/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “”, line 4, in top-level template code
File “/home/frappe/benches/bench-2017-11-28/env/lib/python2.7/site-packages/jinja2/environment.py”, line 430, in getattr
return getattr(obj, attribute)
UndefinedError: ‘doc’ is undefined
Hi
Could you capture screen of your code?
Here a screenshot and the code. Thanks!
Francois De Man
Operations Manager • 1wAVe sprl
+32 478 56 64 82 <tel:+32 478 56 64 82>
Hi francoisDeMan
Ok I see. you can try this again
{{frappe.utils.formatdate(due_date, “dd-MM-yyyy”)}}
Thanks again for your assistance, Vincent.
I’m out of luck again this time… (screenshot below) Any idea on how to fix it for good?
Reagrads,
Francois
Francois De Man
Operations Manager • 1wAVe sprl
+32 478 56 64 82 <tel:+32 478 56 64 82>
Hi
Pls attachment your screen shot. I don’t see it
Better now?
Francois De Man
Operations Manager • 1wAVe sprl
+32 478 56 64 82 <tel:+32 478 56 64 82>