Ampower Farmaans is a custom Frappe app designed to allow users to customize the print format for documents of a specific DocType using .docx
files.
- Customize the print format for various documents.
- Utilizes
.docx
files for defining print formats. - Support for both static and dynamic data in print formats.
- Easily map dynamic data from the document to the
.docx
template using Jinja templating. - Field names for dynamic data are available in the DocType customization section.
To create a custom print format, follow these steps:
-
Create a
.docx
Template: Start by creating a.docx
file that contains your custom print format. This file should have both static and dynamic sections. Refer to for an example of highlighting field names and labels in the DocType. -
Jinja Templating: For dynamic data, use Jinja templating by placing field names in double curly braces, e.g.,
{{ fieldname }}
. For populate tables need to add for loop Refer to for an example of Jinja tags in a.docx
file. -
Select DocType: In the "Template Docx" DocType, select the relevant DocType from the "DocType For" dropdown list. This associates your custom print format with a specific DocType.
-
Upload Template: Use the "Template File" field to upload your
.docx
template. Template file list
On the document page of a specific DocType, you'll find a "Get Print" button. Follow these steps to use your custom print format:
-
Click "Get Print": Click the "Get Print" button to open a dialog.
-
Template Selection: Choose your custom template from the dropdown list. Refer to
-
Attach Docx: Click "Attach Docx" to attach the
.docx
print format to the current document. This will populate the document with data from the template. -
Download Docx: Alternatively, you can click "Download Docx" to download the print format in
.docx
format.
To extend this feature to other DocTypes, follow these steps:
-
Create Custom Script: Create a custom script similar to the ones provided for "Sales Order," "Sales Invoice," and "Delivery Note." Adjust the DocType name in the script to match the desired DocType.
-
Modify hooks.py: Add the path to your custom script in the
hooks.py
file under thedoctype_js
dictionary. This associates your custom script with the specific DocType.
MIT License
- Ambibuzz Technologies LLP and contributors
Note: Ensure that you have correctly set up your naming series, field values, and templates to use this app effectively.
MIT