Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let users create their own templates #283

Closed
zerotraceme opened this issue Dec 17, 2021 · 6 comments
Closed

Let users create their own templates #283

zerotraceme opened this issue Dec 17, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@zerotraceme
Copy link

Love the look and feel so far. One thing I'd love and why I'm still not really using ERPNext is that designing my own invoice templates is a real pain in the butt.

Here is what I have in mind:

  • Give users a simple way of building / coding their own templates
  • Access to / documentation about the field names from items etc. and following sensible naming, so a user can guess the correct value and doesn't always have to hunt around for the variable name that's used under the hood
  • PDF preview and generation should look the same, without any big css setup from my part (so far this looks great in Frappe Books!)

You might want to look into using MJML as helper for that. It's open-source and meant for responsive Email, but I could imagine using their App to design my template, then just copy paste the HTML into a file and use that as template here.
That would make it much easier to design customised, beautiful invoices. Especially, because I could add {{ doc.customer_name }} as text in my design and just copy paste the whole thing over into my Books template file. Making small adjustments is much smoother that way.

They also have some json capability etc, so I can imagine there should be a relatively easy way of setting it up so that this "Email HTML" can generate a PDF.

<mj-section background-color="#fff"> <mj-column width="100%"> <mj-text css-class="bold" mj-class="is-size-6">{{ doc.select_print_heading or doc.doctype }}</mj-text> <mj-text css-class="bold" mj-class="is-size-7">{{ doc.customer_name }}</mj-text> </mj-column> <mj-column width="60%"> <mj-text css-class="" mj-class="is-size-7">{{ doc.address_display }}<br>{{ doc.territory }}</mj-text> <mj-text css-class="bold" mj-class="is-size-7">{{ doc.transaction_date }}</mj-text> <mj-text css-class="" mj-class="is-size-7">{{ doc.territory }}</mj-text> </mj-column> <mj-column width="39%"> <mj-text mj-class="is-size-7"><strong>{{ doc.select_print_heading or doc.doctype }}-No:</strong> {{ doc.name }}<br><strong>Date:</strong> {{ doc.transaction_date }}</mj-text> </mj-column> </mj-section>

This is my start on integrating ERPNext doc variables into my MJML template. It works fine so far, but PDF preview and generation look off, so I stopped in frustration for now...

Happy to test and help out with this, it's one of the features I haven't really seen in tools so far.

@18alantom 18alantom added the enhancement New feature or request label Dec 20, 2021
@18alantom
Copy link
Member

Customizable templates is something we will be adding in once most of the basic requirements such as import, export, etc are taken care of.

The question is how customizable. ERPNext has the Print Format Builder (docs are outdated, I'd suggest checking it on a trial instance it's pretty neat), but this doesn't allow for coded templates as of yet.

Mostly initial implementation of this request will include a draggable interface a la Print Format Builder, then move onto support code templates.

Will keep you updated wrt progress on this.

@zerotraceme
Copy link
Author

Yeah sounds like a plan! Ideally, I wouldn't have to code at all. I would want to have a way to access available variables (through print format builder for example) but also know which classes I can style with my own css.

I think my main problem was not knowing which classes and styles get applied to the printing preview, then to the pdf dialog, and to the print itself. They all had different classes and styles, so it was difficult to anticipate which styles to reset and why some changes weren't being applied etc...

In the end I wasn't able to use my styled invoice without dedicating more time to it, so I never really got into using the whole system (which isn't ideal and probably not super common, but I really need the aesthetics to be right).

So yeah to recap, these could be solving the problem without too much change in the roadmap:

  • print format builder
  • ability to give elements custom css-classes
  • making it clear which classes and styles I need to change for the desired outcome
  • way to add my own custom css

I'll attach a screenshot of the design I've tried to replicate.

Invoice_2019-01-003 copy

@zerotraceme
Copy link
Author

Ok I definitely need to try again using the print format builder, it looks really useful.
Probably only point I got to solve then is:

  • making it clear which classes and styles I need to change for the desired outcome

@boobo94
Copy link

boobo94 commented Mar 24, 2022

Having such a feature would be great or even a new template that contains the customer and company details in two columns like in leprodude image.

@test2a
Copy link

test2a commented Jul 19, 2022

is there any project that does "print format builder" outside of erpnext ? like a library or something?

@18alantom
Copy link
Member

In the next version of Frappe Books the Template Builder will be included, you'll be able to create custom templates using this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants