ERPNext.com Frappe Cloud Support Partners Foundation

Customer balance and loyalty points

Hello Community, I have this custom print format. Its working well but I would like to list accumulated customer loyalty point and customer outstanding balance. When I pull the field “loyalty_points” Its printing zero. The customers have already earned some points

indent preformatted text by 4 spaces
{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead) -%}
{% if letter_head and not no_letterhead %}
<div class="letter-head">{{ letter_head }}</div>
{% endif %}
{%- if doc.meta.is_submittable and doc.docstatus==0-%}
<div class="alert alert-info text-center">
    <h4 style="margin: 0px;">{{ _("PROFORMA") }}</h4></div>
{%- endif -%}
{%- if doc.meta.is_submittable and doc.docstatus==2-%}
<div class="alert alert-danger text-center">
    <h4 style="margin: 0px;">{{ _("CANCELLED") }}</h4></div>
{%- endif -%}
{% if max_pages > 1 %}
<p class="text-right">{{ _("Page #{0} of {1}").format(page_num, max_pages) }}</p>
{% endif %}

{%- endmacro -%}

{{ add_header(0,1,doc,letter_head, no_letterhead) }}

Customer Details Invoice#: {{doc.name}} Details
{{ doc.customer }}
{{ doc.address_display or '' }}
INVOICE #: {{doc.name}}
{% set u = frappe.get_doc("User", frappe.user) %} INVOICE DATE: {{ doc.get_formatted("posting_date") or '' }}
DUE DATE: {{ doc.get_formatted("due_date") or '' }}
PREPARED BY :{{ u.first_name }}   {{ u.last_name }}
{{frappe.session.user}}
		</td>
    </tr>
    
</tbody>
</table>
{%- for row in doc.items -%} {%- endfor -%}
No Item Code Description Qty Rate Amount
{{ row.idx }} {{ row.item_code}}
{{ row.description }}
{{ row.qty }} {{ row.uom or row.stock_uom }} {{ row.get_formatted("rate", doc) }} {{ row.get_formatted("amount", doc) }}
Amount in Words
{{ doc.base_in_words }}
SUB TOTAL {{ doc.get_formatted("total", doc) }}
VAT {{ doc.get_formatted("total_taxes_and_charges", doc) }}
TOTAL {{ doc.get_formatted("grand_total", doc) }}
    <th width=25%>Invoice Amount</th>
    <th>Total Outstanding</th>
    <th>Loyalty Points</th>
    </tr>
    <tr>
          <td>{%- for row in doc.sales_team -%}

{{ row.sales_person }}

{%- endfor -%}




</tbody>
</table>
Sales Person {{ doc.get_formatted(“grand_total”, doc) }} {{ doc.get_formatted(“loyalty_points”, doc) }}
</tbody>
</table>
Terms and Conditions
{{ doc.terms or '' }}