Print Format for Salary Slips

Is there a way to have ERPNext to show a different salary slip print format based on the time of salary slip? We pay our employees on salary and via timesheets. I have a print format for each style that is mostly the same, but for the salary employees we don’t show the timesheet section. I would like to be able to have ERPNext “know” what type of salary slip is showing and then determine the correct print format automagically. Thoughts?

You can if you use jinja for your print formats and utilize the conditional formatting as follows:

{%- if doc.field -%}

some print fields and formats


Interesting. Where would I insert that code? I don’t see a place to utilize that on the forms for print formats.

If you are using the wizard, not sure if you can use this method. You may be able to insert an HTML section and add the code. Have not tested it though.

Have a look at the POS Invoice format. It uses the jinja templating method. You can see examples on how the conditional formatting is used for displaying discounts. It only prints the discount line if it is present.

Good Luck.

Thanks for the tip. I see how it’s done now.