Problem with get data

Im trying get the name of customer.
Code:

Para: {% set u = frappe.get_doc("User", doc.owner) %} {{u.customer_name}}

Return:

Where are you trying to do this on? A print format? Can you give more context?

Yes, print format
RETURN:

CODE:

There is no field customer_name is the User doctype. Where are you trying to set the customer name from? what is the doctype? If there is a field called customer in the doctype you are trying to print, you could use

Para: {{ doc.customer }}
CNPJ:  {% set u = frappe.get_doc("Customer", doc.customer)%}
{{ u.idcompany }}

Fone:  {% set u = frappe.get_doc("Address", doc.customer_address)%}
{{ u.idcompany }}
1 Like

Hum… So in “User” i have to specify what kind of DocType?!
I see this on github, because variable don’t change, so i put it there and i did not pay attention to DocType…
The DocType is Quotation, but i don’t find this datas there, I need id/ENI company of my customer, Name, Phone and E-mail.

Now i tried this:

Para: {% set u = frappe.get_doc("Sales Order", doc.owner) %} {{u.customer_name}}

RETURN: The resource is not avaible

Oh m sorry, i didn’t see that, i will try

If you are printing a quotation, I have this working:

Para: {{ doc.customer }}
CNPJ:  {% set u = frappe.get_doc("Customer", doc.customer)%}
{{ u.idcompany }}

Fone:  {% set u = frappe.get_doc("Address", doc.customer_address)%}
{{ u.phone }}

Phone numbers are stored in Address, so you have to have chosen an address for this to work.

I’m assuming that idcompany is a custom field.

1 Like

I Paste wrong, sorry
Ok, so i tried the name first.
CODE:

Para: {% set u = frappe.get_doc("Customer", doc.owner) %} {{u.customer_name}}

RETURN:
Resource is not avaible

Ok i find the directory:

But i’m still having the same problem

Ok i got it!
But im having problem on this:

CODE:
“{% set u = frappe.get_doc(“Payment Entry”, doc.paymententry)%}
{{ u.type_of_payment}}”

RETURN:
Alert: “The resource is not avaible”