Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Show Mode of payment used in Point of sale invoice

i want to add payed by in point of sale print

<tr>
		<td class="text-right" style="width: 60%">
			{{ __("paid by") }}
		</td>
		<td class="text-right">
			{% for m in payments %}
				{{ m.mode_of_payment }}
			{% endfor %}
		</td>
	</tr>

Wrote this but this adds all the mode of payments in the list - like cash visa mastercard
I want to only show if there is any value inside and not zero i.e actually paid by that mode and not just list of all modes…

i tried adding something like this inside the loop :

				{% if m.mode_of_payment !=0  %}
					{{ m.mode_of_payment }}
				{% endif %}			

Doesn’t work …
how to access the value inside ?
something like m.mode_of_payment.value ?

please suggest
Thanks!

Try this

{%- for row in doc.payments -%}
<p align="center"><b>{{ _("Paid By") }}:</b> {{ row.mode_of_payment }} - {{row.get_formatted("amount") }}
1 Like

hi @mdwala , thanks for the reply
unfortunately the code doesn’t work…

also this type of code with doc.payments and get_formatted () works only on server type of format which POS invoice has ,
Point of sale print is Js type…
And even on server type this code would display all modes and its amout like
Cash - 0.0
Visa -0.0
mastercard -2.5

i want only the mode payed for ,., like only show payed by master card in above case …

any suggestions?
i cant find the write examples in jinja templates examples

No one in this big forum has any idea about how to work the jinja templates???
or done something similar.

The problem with the POS is that is it JS and Client … so no Doc. can be read.
This taking into account that your POS can be offline …

Try this code
{% for pay in payments %}
{% if pay.amount %}
{{ pay.mode_of_payment }}
{% endif %}
{% endfor %}

1 Like

Hey @Helio_Jesus

This code seems not to work with the Point of Sales template on v13

any ideas what to tweak on the code

{% for pay in payments %} {% if pay.amount %} {{ pay.mode_of_payment }} {% endif %} {% endfor %}

thanks

Hi @EnSeal
Unfortunately we have not yet tried v12… The code was only for v10.
We are using v12 but not implemented POS.
Have you tried to debug to see what errors raised?

No I haven’t…

I think the code changed on v13… I am trying to figure that out

anyone has this code working for v12

Have you looked at this? It works on V11 and V12.

Just add doc for payments see below. That is working on V13 that I am using

{% for pay in doc.payments %}
{% if pay.amount %}
{{ pay.mode_of_payment }}
{% endif %}
{% endfor %}

Cheers