How can I add timestamp to my Print Format?

I am currently using a duplicate of the “POS Invoice” print format format to print receipts on a POS receipt printer. The receipt displays the “Date” field of the the coresponding sales invoice record. How can I get the posting time of the invoice to also appear on the receipt?

Currently, the section of the print format that handles the date looks like this:

	<b>{{ _("Receipt No") }}:</b> {{ }}<br>
	<b>{{ _("Date") }}:</b> {{ doc.get_formatted("posting_date") }}<br>
	<b>{{ _("Customer") }}:</b> {{ doc.customer_name }}

What do I have to add to it to possibly get the timestamp to appear right after the date (on the same line hopefully)??

Can anyone provide some guidance here?



I might be misunderstanding your question here, but it seems like this is just a matter of changing the jinja template.

If you change this line:

<b>{{ _("Date") }}:</b> {{ doc.get_formatted("posting_date") }}<br>

to this:

<b>{{ _("Date") }}:</b> {{ doc.get_formatted("posting_date") }} {{ doc.posting_time }}<br>

does it accomplish what you’re trying to do?

That is almost it. When I use that edit to the format the date and time print like this:

Date: 04-06-2019 7:39:18.241915

How might I truncate the decimal points of the seconds to keep it looking good?

I am not a programmer and do not know the jinja syntax, so you help has been great.


Here’s a link to jinja reference,

ctl-f truncate