Print Date & Time

Hi sir

any document means print for quote, sales/purchase order delivery note & …

i am checking the link shared by you

Thank You

no header or footer area where you can add and specify what you require but use Terms and Conditions area

https://erpnext.org/docs/user/manual/en/setting-up/articles/manage-header-and-footer?

Dear Sir

I need the option which automatically print the date & time of the printed document.

For example, if i print a quote on 18th September 2017 at 5 PM then the print must show this data automatically. same for other printed documents.

Thank You

@clarkej
The document link you have provide seem old.

ERPNext doesn't have option to define standard Footer. As a work around, you can use Terms and Condition master for footer.

Now, ERPNext provide feature to add standard footer, you can set it in letter head. Also if someone know jinjha, he can write custom custom html print format to add printed date and time

cc
@Bhagyashree_Aher please fix this document with our document that explains how to add footer with date and time sample code

Thank you for catching and clarifying this Sambhaji

Please when you have time, would you review this below assuming you have past experience with list filter, to offer your opinion: the 'OR operator editor may have been broken from a change in say June - thank you
How to filter Tasks on both Open OR Overdue Tasks - #6 by clarkej

How i can contact Mr. Jinjha for my request?

@nasirshah
{{ frappe.utils.today() }} will print todays date in print format.
refer https://erpnext.org/docs/user/manual/en/customize-erpnext/print-format

@clarkej
I think its by design taking AND condition.
So if you want Overdue and Open Task you can use IN filter.

3 Likes

Dear Mr. Kolate

I have to only execute the script & the date/time will be printed on any document?

Thank You

Dear Team

I did the script execution as given in above update but time/date is not printed. Can some 1 guide me pls.

Thank You

try {{ frappe.utils.now() }}

Cant see the date & time on the pint preview.

You need to write script in Print Format, as you need this in printing document

54 PM

it worked for me.

Thanks for helpful information!

But i want to add only simple time like dd.mm.yyy

How i can do it?

{{ frappe.utils.now().strftime('%Y-%m-%d') }}

This should work.

Tankh your for answer!

But your code not working in my project.

Error message is here:

Traceback (most recent call last):

File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 80, in render_template
return get_jenv().from_string(template).render(context)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/asyncsupport.py”, line 76, in render
return original_render(self, *args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/_compat.py”, line 37, in reraise
raise value.with_traceback(tb)
File "

Was searching for something similar today like this. Got same Jinja error. Below code works perfectly on V12
{{ frappe.utils.formatdate(doc.get_formatted('creation'), "dd-MM-yyyy") }}

1 Like

There is a bug in the formatdate, because if you ask for MMMM. it will return the day.
For december 4, 2020, it returns “April”. taking the day for the month.

Hello,

As a workaround, you can also directly use the browser’s print header.

{{ frappe.utils.formatdate(frappe.utils.today(), 'dd-MM-YYYY') }} {{ frappe.utils.now_datetime().strftime('%H:%M') }}

2 Likes