I have updated ERP Next to version 12 and I have checked that this instruction prints an empty string in custom print format (the same happened to ERP Next version 11):
{{ frappe.db.get_value("Customer", doc.customer, "tax_id") or "" }}
That occurs even when I have tax id value set. I have seen tabCustomer mysql table content and I have checked that tax id is there.
Just to test, I have changed that instruction by:
{{ frappe.db.get_value("Customer", doc.customer, "email_id") or "" }}
And I have seen that the e-mail that was displayed belongs to other customer, not the one the quotation is to!
If there is no solution to this bug, can you give me a clue about what python file should I see?
I have saved other customer so that he appears at the top of the customers list. Then I loaded the customer’s quotation, and surprise, the TAX ID that appeared belongs to the updated customer and not the customer the quotation is addressed to.
{{ frappe.db.get_value("Customer", {'name': doc.customer_name}, "tax_id") or "" }}
Due to a strange reason, system could not link both Quotation and Customer tables. One of the attempts was to add Customer link in Quotation DocType but it did no work.
My guessing is that since Quotation table has already a field named customer, it could not link that with the Customer table and the name field.
By comparing contact_person field of Quotation DocType, I don’t really know why that link to Contact table does work and the link to Customer table does not.
This is clearly a bug from my point of view but the important thing now is that the workaround worked
Even a quick check of the JSON or the Quotation doctype would indicate that there’s no field named ‘customer’ in the quotation which frm.doc.customer can access in order for the original code to work by default unless a link field is specifically added.
When you passed { name:doc.customer_name } it is passing the correct link field to work.