Print issue {{ frappe.db.get_value("Customer", doc.customer, "tax_id") }}

i using
TRN#: {{ frappe.db.get_value(“Customer”, doc.customer, “tax_id”) }}
Customer#:{{ frappe.db.get_value(“Customer”, doc.customer, “customer_code”) }}

They are displaying in erpnext like

But when i output pdf, these two fields display “None”

How to make the value can be displayed in pdf.

My system is:
ERPNext: v11.1.44 (master)
Frappe Framework: v11.1.39 (master)

1 Like

Try this …
edit the site_config.json, and add the static IP address of your local server.

“host_name”: “
then do a bench restart

thank you for your reply.
Now in my site_config.json
“host_name”: “”,

so now if i change to static IP,like

Is there any other problem happen?

i did two trials:
“host_name”: “http://localhost”,
“host_name”: “”,

the same problem, in erpnext, ok, but display “none” in pdf.

You need to adjust the IP address to match your requirements - I just used as an example

i think i using http://localhost is the same function as static ip, right?
Now localhost is not working for solving this issue.

If you have an entry in the /etc/hosts file that matches the IP of your machine, then it should also work, so like this (but change the xxx to match the actual IP) localhost

now in my /etc/hosts: manchemical localhost

So i need to add, or change manchemical?

Now I add 167.xx.68.6
So it looks like: manchemical localhost

167.xx.68.6 is my server ip.

but still display “none” in pdf.

just now even i change
“host_name”: “https://167.xx.68.6” in site_config.json
and bench restart.

Still “none” in pdf.

sorry, i am fresh in erpnext, and appreciated to help me, please help me to solve this issue!

Did you create a report builder version, or is this a Jinja2 output?

i dont know, i installed original erpnext.

How is this even related?

Check if the customer has that data. I will provide a sample below with even additional custom fields:
{%- if frappe.db.get_value(“Customer”, doc.customer, “customer_type”) == “Individual” -%}
{%- if frappe.db.get_value(“Customer”, doc.customer, “tax_id”) -%}{{ frappe.db.get_value(“Customer”, doc.customer, “tax_id”) }}{%- endif -%}
{%- else -%}
{{ frappe.db.get_value(“Customer”, doc.customer, “tax_office”) }}/{{ frappe.db.get_value(“Customer”, doc.customer, “tax_id”) }}{%- endif -%}

1 Like

can try to help if you can post the whole code

i tried your code today, still problem.
please check the code here:


<div id="header">
<table style="width:100%;margin:0;padding:0; max-width:100%;font-family:verdana; font-size:10px;color:#666">
<td colspan="6" style="width:50%;padding-left:10px">TO:</td><td colspan="4" style="width:50%;padding-left:10px">Customer Reference</td>

<td colspan="6" rowspan="6" style="width:50%;padding-left:10px;font-style:italic;color:#333">{{ doc.customer_name or '' }}<br />{{ doc. address_display or '' }}<br />TRN#:{{ frappe.db.get_value("Customer", doc.customer, "tax_id") }}
<td style="padding-left:10px;width:16%">Customer#:</td>
<td align="right" style="width:11%; font-style:italic;color:#333">
{{ frappe.db.get_value("Customer", doc.customer, "customer_code") }}</td>
<td style="padding-left:10px;width:13%">Invoice#:</td>
<td align="right" style="width:10%;font-style:italic;color:#333"><span class="serials">{{ }}</span></td>
<td style="padding-left:10px;width:16%">Currency:</td>
<td align="right" style="width:11%;font-style:italic;color:#333">{{ doc. currency or ''}}</td>
<td style="padding-left:10px;width:13%">IncoTerm:</td>
<td align="right" style="width:10%;font-style:italic;color:#333">{{ doc. incoterm or ''}}-{{ doc. incoterm_fill or ''}}</td>
<td style="padding-left:10px;width:16%">Transport:</td>
<td align="right" style="width:11%;font-style:italic;color:#333">{{ doc. transport or ''}}</td>
<td style="padding-left:10px;width:13%">Lead Time:</td>
<td align="right" style="width:10%;font-style:italic;color:#333">{{ doc. lead_time or '' }}</td>
<td style="padding-left:10px;width:16%">Prepared By:</td>
 {% if doc.owner -%}
    {% set u = frappe.get_doc("User", doc.owner) %}    {% endif %}       
<td align="right" style="width:11%;font-style:italic;color:#333">{{ u.first_name or ''}}</td>

<td style="padding-left:10px;width:13%">Credit:</td>
<td align="right" style="width:10%;font-style:italic;color:#333">{{ doc.get_formatted("credit_days") or ''}} Days</td>
 {% if %}      
    {% set u = frappe.get_doc("Company", %}           
{% endif %}
  <td style="padding-left:10px;width:16%">Company:</td>
  <td colspan="3" align="right" style="width:11%;font-style:italic;color:#333"><span style="margin-right: 10px">{{ or '' }}</span> {{ u.other_company_name or '' }}</td>

<td style="padding-left:10px;width:16%">License#: </td>

<td align="right" style="width:11%;font-style:italic;color:#333">{{ u. license_no or '' }}</td>
<td style="padding-left:10px;width:13%">TRN#:</td>
<td align="right" style="width:10%;font-style:italic;color:#333">{{ u. trn_no or '' }}</td>
{% if doc.contact_person %}      
    {% set u = frappe.get_doc("Contact", doc.contact_person) %}           
{% endif %}
<td style="width:5%;padding-left:20px">Tel:</td>
<td colspan="2" style="width:20%;font-style:italic;color:#333">{{ or '' }}</td>
<td style="width:5%;padding-left:20px">Fax:</td>
<td colspan="2" style="width:20%;font-style:italic;color:#333">{{ u.fax or '' }}</td>
<td style="padding-left:10px;width:16%">Tel: </td>
{% if %}      
    {% set u = frappe.get_doc("Company", %}           
{% endif %}
<td align="right" style="width:11%;font-style:italic;color:#333">{{ u.phone_no or '' }}</td>
<td style="padding-left:10px;width:13%">Fax:</td>
<td align="right" style="width:10%;font-style:italic;color:#333">{{ u.fax or '' }}</td>
<td style="width:5%;padding-left:20px">Email:</td>
{% if doc.contact_person %}      
    {% set u = frappe.get_doc("Contact", doc.contact_person) %}           
{% endif %}
<td colspan="5" style="width:45%;font-style:italic;color:#333">{{ u.email_id or '' }}</td>
<td style="padding-left:10px;width:16%">Issued On:</td>
<td align="right" style="width:11%;font-style:italic;color:#333;">{{ doc.get_formatted("transaction_date") or ''}}</td>
<td style="padding-left:10px;width:13%">Overdue:</td>
<td align="right" style="width:10%;font-style:italic;color:#333;">{{ doc.get_formatted("valid_till") or ''}}</td>



these two place has display issue.

what happens when you type the code under bench console?

We definitely need the line numbers. We are not personal debuggers.