Hey everyone,
couldn’t find a similar topic in the forum search, so I hope someone can help me with this.
Currently I’m running ERPNext on version 14 with a nearly default setup.
One adjustment I needed to make, besides a custom print format for my sales quotations and invoices, was to add the possibility for an intro and outro text on my quotations and invoices (just one or a few sentences before and after the positions list).
To have it a little bit more standardized I decided to save create my own simple custom doctypes which should contain the text phrases, so I can easily reuse them again.
These doctypes are really simple and just contain the following data(types) - for now I will refere to the intro:
- intro_name (data)
- intro_text (short text)
- naming series (INV-INTRO-{intro_text})
After that I linked these doctype fields into the standard sales invoice doctype (inv_intro_text) which is working already (type: link, option: custom intro doctype, fetch from: intro_text).
Unfortunately this results into the situation that the custom field inside the sales invoice does contain just the naming series after the selection and when I’m trying to fetch from this field in my print format ({{doc.inv_intro_text}}) it will just enter the naming series instead of the actual short text (which kinda makes sense…).
At this point I’m currrently struggeling - I tried out a few things, but nothing did solve my problem.
- First thing I tried was to catch the “intro_text” directly out of the doctype:
{% set my_intro_text = frappe.get_doc("Sales Invoice Intro Text", intro_text) %}
{{ my_intro_text.intro_text }}
At first it looked promising, because the only issue was that the text was not formated, but later I recognized that it will only take the first data set out of the doctype - so, no my selection inside the sales invoice did not matter at all.
- The second thing I tried was to add an additional related field (intro_display) inside the sales invoice which contains the actual “intro_text” value/short text. (type: link, option: custom intro doctype, fetch from: custom intro doctype.intro_text). And my plan was to fetch this field afterwards inside my print format.
At first it seemed to work and the short text was displayed (formated!) inside the new field, but when I tried to save the changes I got the message that “intro_field could not be found”.
Unfortunately I’m out of ideas now and I don’t know how to resolve one of these issues, because I’m still new to the ERPNext world…
I would say that fetching the “intro_text” directly for the print format would be the easiest way, but I can’t work it out…
Has someone any advice or idea?