Help Articles For ERPNext Part 5
Add Columns in Standard Report and Export
Users of ERPNext (v16) can add or remove columns on the fly in Standard Reports like Statement of Accounts (SOA), Accounts Receivable, Accounts Payable, and other built-in financial or analytical reports. You can do this right from the report interface by using the column configuration options. These changes let users temporarily change the report view to show more fields from the related documents. This makes it easier to analyse or quickly look up information. These column changes are only for that session and are only meant to be seen on the screen at that time. When you refresh or reopen the report, they don’t automatically stay.
The user must save the changed report configuration if they want to export the report with the added or removed columns. The system sees the report as a user-defined layout after you save it (as a Custom Report or by saving the current report configuration). The Export option (CSV, Excel, etc.) will include the custom columns exactly as they are shown in the report once it is saved. This makes sure that the exported file has the same structure, filters, and columns as the report that the user set up and saved.
Fetch child table values using Jinja tags
You can use Jinja templating in ERPNext v16 a lot in Print Formats, Email Templates, and other rendered views to show and reference data from DocTypes. You can get values for simple fields in a DocType by using the syntax {{ doc.field_name }}, where doc is the current document context. This works perfectly for all standard and custom fields that are set up on the parent DocType.
But this direct method doesn’t work for Child Tables because they keep multiple rows as a list of child documents instead of a single value. You need to use Jinja control structures to go through the rows of the child table in order to get and show the data. This article shows you how to properly navigate and display child table values in ERPNext v16.
Requirements
We need the variable name (field name) of the child table as it is set up in the parent DocType. This is not the label that appears on the form; it is the actual field name that the system uses internally. To find this, open Customize Form, choose the parent DocType you need, and then find the child table field. The value in the Fieldname column is what the Jinja template will use (for example, items).
We need the field names of the individual columns inside the child table as well as the field name of the child table itself. These field names are for the child DocType that is connected to the table, like Sales Order Item. To get these, open Customize Form for the child table DocType and write down the names of the fields you need, like item_code, qty, rate, and amount. To retrieve the correct values in Jinja, you’ll need to reference these internal field names.
Step 1: Child Table Rows are displayed in the form of an Unordered List.
This technique is helpful when you require indicates its data ownership / child bases disorganized, in a straightforward, upper class arrangement, but not a regular table. It is commonly employed to get fast print outs or a summary. The loop, which is the percentage of the percentage loop, accesses field values on a row by row basis.
{% for row in doc.items %}
Item Code: {{ row.get_formatted(“item_code”, doc) }}
Quantity: {{ row.get_formatted(“qty”, doc) }}
Rate: {{ row.get_formatted(“rate”, doc) }}
Amount: {{ row.get_formatted(“amount”, doc) }}
{% endfor %}
The get formatted method ensures that values are displayed as per the way ERPNext handles formatting, and is particularly useful on financial fields. These guidelines consist of such things as the symbols of currency, accuracy of numbers, and locale specific formats.
The print would have a format as illustrated below: the child rows would be printed one by one and their values.
Method 2. Displaying rows of a Child table in form of a table.
It is the last thing that you want to do when you want to see a structured, tabular view of child table data and which is generally to do with documents such as Sales Orders, Purchase Invoices, and Delivery Notes. It is very similar to the child table appearance on the ERPNext UI.
<sent>
<thead
<tr>
<th>Code for the Item</th
<th>Amount</th
<th>Rate</th>
<th>Amount</th
</tr>
<thead>
<tbody>
{% for item in doc.items %}
<tr>
<td>{{ item.item_code }}</td
<td>{{ item.qty }}</td>
<td>{{ item.rate }}</td>
<td>{{ item.amount }}</td>
</tr
{% endfor %}
</tbody>
</table>
In print form the following would be a presentable table; each child row as an independent line entry at the same level as the right column heads. This is an ideal technique of official papers and exports where it matters that they should be easily read and line up.
This template may serve as a guide to ERPNext v16. Other fields in the child table, such as the discounts, warehouses, the batch numbers, or custom fields, can also be obtained in the same manner by including the name of the fields within the child table and updating the Jinja template accordingly.
Change Custom Field Datatype After Field Creation
ERPNext v16 In ERPNext v16, when you add a Custom Field and fill in the form, the system changes the database depending on the datatype you select the field. Due to this, it is not possible to alter the datatype of a saved and used field in Customize Form. This limitation exists to ensure that data is not lost or databases are not inconsistent particularly where there are already values of such field in existing records.
We can take a typical scenario and look at how one can do this properly.
Suppose that in a DocType you made a custom field that you named “Client” and its data type was Data initially. Once you save the Custom Field and click on Update, the field will be created yet will be available to be used on the form. The column in the database is defined as a varying character.
However, after a while you come to understand that this field is supposed to be a Link field such as a field which is linked with the Customer DocType and not simply a text field.
On attempting to modify the Data type of Data to a Link directly on Customize Form and then clicking an update, ERPNext throws an error (see the screenshot). This is because the Customize Form interface cannot allow one to modify certain datatypes after the field has already been introduced into the database schema.
You need to change the Custom Field record directly to fix this problem. Use the search bar (Awesome Bar) to go to the Custom Field List and find the custom field whose datatype you want to change.
Open the record for the custom field. You can now safely change the Field Type to the new datatype you want. Make sure that all of the new datatype’s required properties are filled out correctly. For instance, if you want to change the datatype to Link, you need to enter the name of the target DocType in the Options field (like Customer, Supplier, etc.). If necessary, check the other settings that are related, such as Length, Default, and Mandatory. Next, save it.
After you save, go back to Customize Form, reload the form, and check the field settings. The custom field should now show the new datatype and act like the new field type in ERPNext v16.
Note:
Older Frappe versions (v12–v13 era) were more permissive and allowed some unsafe schema changes through the UI.
Starting around v14+ (and enforced strictly in v15/v16):
-
Frappe locks the database column type
-
This is to prevent:
-
Silent Data Corruption
-
Broken Indexes
-
Production Crashes
-
Company-wise Naming Series
ERPNext v16 is an answer to such a typical requirement of businesses across multiple organizations: different document numbers. This is essential in proper accounting, regulation and reporting. Very often, the use of a company-specific naming series is necessary with transactional documents such as Sales Invoices, Purchase Orders, Delivery Notes, and similar even when the same DocType is used.
Consider a scenario involving these three businesses:
- Company A
- Company B
- Company C
The purpose is simple: the companies must have unique document numbers. Take an invoice of sale, say:
- A → SINV-A-0001
- Business B → SINV-B-0001
- Company C → SINV-C-0001
In ERPNext v16, this is possible without having to customize the system through scripts. Its trick here is to actively add the Company Abbreviation to the Naming Series. Here’s how to configure this.
1. To start with, you have to access the DocType you require unique naming series, according to the chosen company. In this case, we are going to consider Sales Invoice. This will make it possible to add the custom fields and modify naming series options without losing the main structure of the DocType.
2. Locate Find the Company on the form. Below this, also, you have to make an additional Custom Field, the name of which is Abbr.
3. Change the Field Type to Data. Next type in the Fetch From field company.abbr. This automatically enters in the abbreviation name of the selected company.
4. You may put a Hidden mark on this Abbr field. It is just required to propagate the logic within the company, and end users do not have to view it daily. Hiding it is also useful in ensuring that the form interface remains clean and easy to use.
Now, on the same Customize Form screen, scroll down to the Naming Series field row and click the arrow to the right of it. Put a new naming series entry on a new line in the Options box. For the example of a Sales Invoice, type in:
- SINV-.abbr.-.####
Here, .abbr. dynamically resolves to the value fetched from the Company’s abbreviation, and .#### makes sure that the numbers in the sequence always go up. Make this new series the Default naming series for the DocType.
After making these changes, click Update to save them. ERPNext will change the way the form is laid out and how it names things.
Now, go to Sales Invoice and make a new record. As soon as you choose the Company, the system will automatically get the company’s short name and use the right naming series. The document number will be created on the fly based on the company you choose, making sure that all of your ERPNext v16 setups have the same document numbering for each company.
Feedback Request Using a Web Form
In ERPNext v16, you can use built-in customization tools to collect structured feedback from customers and internal users in a way that is both flexible and scalable. Earlier versions, like v11, had a more direct feedback feature. ERPNext v16, on the other hand, encourages the use of configurable components that give you complete control over how feedback is collected, stored, and acted on. This method makes it easier to add new features, improves security, and makes sure that it works with modern ERPNext workflows.
You can use the following built-in features in ERPNext v16 to add this functionality:
- DocType that you make yourself
- Web Form
- Alert
Here are the steps you should follow to set up a way to collect feedback and ratings directly in ERPNext.
Feedback as a Document Type
First of all, the thing you would like to do is to create a Custom DocType. All ratings and feedback users will leave their ratings and comments in this. Imagine it as a data box that is structured and pre-existing technology to be utilized in automations, reporting, or human retrospe.
Make a special Doctype of collecting feedback or ratings, which should be in the form of:
The former must be a(s) Link or Dynamic Link, which takes the user to the exact DocType you are seeking feedback about. This may either be a Sales Order, Delivery Note or Support Issue, or any other document that would be appropriate. This design enables similar feedback mechanism with a number of business documents.
- In order to configure it as a Dynamic Link, just type in the name of the first field and say document in the Document Name field. It is also easy to look at the entire situation by having the feedback directly attached to the document where it is going to happen.
- With ERPNext v16, you can now include a Rating field.
This feature enables users to rate items, employing a star-based system.
- To gather more significance feedback, consider including additional fields. These could be comment boxes, text areas for remarks, or even dropdowns for specific selections.
Typically, you’ll want to set the DocType to “No” for “Submittable” and “Yes” for “Allow Web View.” This configuration ensures safe usage with Web Forms.
Web Form for Feedback Form
After you put up the Feedback DocType, the following step is to make it available using a Web Form. Customers and partners who aren’t logged in can safely use the online forms in ERPNext v16 to send information.
When you create a new Web Form, choose the Feedback DocType. Include all the relevant standard and custom fields from the Feedback DocType, such as Comments, Document, Document Name, and Rating. Make the form easy to understand and fill out, and conceal any technical fields that the user shouldn’t be able to edit directly.
URL parameters can automatically fill in various fields on the Web Form, such as Document Type and Document Name. This makes it much easy and straightforward to give feedback.
Create a Notification
In ERPNext v16, you may set up a notification to automatically ask for input. You can set up emails or alerts to let you know when specific things happen to your documents. For example, these alerts can go off when a Sales Order is placed, delivered, or recognized as finished.
To alter how you get notifications, do this:
- The reference DocType, such as “Sales Order,”
- The trigger condition, like “On Submit” or “On Update,”
- The consumer, the contact, or the person who owns the document gets it.
Include a link to the Feedback Web Form with prefilled values in the body of the message so they know. For instance:
https://example.erpnext.com/feedback?new=1&document=Sales%20Order&document_name={{doc.name}}
Where:
- Your ERPNext v16 instance’s main URL is example.erpnext.com.
- The Web Form that was built to obtain input is called “Feedback.”
- When you type “document=Sales Order,” the system recognises what kind of feedback the document needs.
- When you put document_name={{doc.name}}, the Feedback form will automatically fill in the name of the document.
This means that the user doesn’t have to enter in or choose document data by hand, which makes things easier and gets more people to reply.
Here’s a brief example:
This is how the feedback loop works in this setup for ERPNext v16:
- A transaction, like a sales order, gets to a specific point
- Customers get an email with a link that takes them to a page where they may submit a review.
- The customer fills out the Web Form and gives a rating and some feedback.
- Feedbacks are saved against corresponding document within ERPNext.
This technique provides a straightforward, easy-to-audit, and very configurable way to collect feedback that works well with ERPNext v16’s workflow, reporting, and automation features.
Manage Tree Structure Masters
ERPNext v16 shows how distinct master records are linked to each other in a hierarchy by using a tree structure. You can make records for parents and kids with tree-structured masters. This makes it easier to keep data neat, structure it correctly, and report on it in a way that makes sense. This hierarchy helps businesses see how well they’re doing, decide who can see information, and keep track of development or distribution at different levels of the corporation.
ERPNext can produce smart reports thanks to tree structures. These reports add the values of child nodes to the values of their parent nodes. This makes it easy to see how things are going in general and in particular. This arrangement is helpful for keeping track of sales, accounting, inventory, and where things are.
This is a partial list of masters in ERPNext v16 that are kept in a tree structure:
- Chart of Accounts
- Chart of Cost Centers
- Customer Group
- Territory
- Sales Person
- Item Group
These are the measures to follow to care for a master with a tree structure and keep track of everything in it. Let’s use the Territory master as an example of how to handle tree masters to make this clear.
Step 1: Go to Master
To get to the Territory master in ERPNext v16, click on the menu:
To set up your territory, click on Setup, then Territory, and then Selling.
When you click this in Tree View mode, the list of territories will open. This view will show you the whole hierarchy of territories that are set up in your system. You may easily open or close layers in the tree view, and you can see how the parent and kid are connected at a glance.
Step 2: The Parent’s Territory
In ERPNext v16, you can add child territories to a Parent Territory by clicking on it. The root parent for all territories is called “All Territories.” You can’t utilize this root node directly in transactions because it’s at the top of the hierarchy.
You can make more than one parent territory group, such as regions, zones, or countries, in All Territories. You can add child territories to each parent territory to create a multi-level organizational or geographic structure that suits for your organization.
Step 3: Make a new area
When you select “Add Child,” a box will pop up with these fields:
- Name of the Land Group
Put the name of the place here. The name you provide this will be preserved as the Territory record, and it will be listed under the parent you picked in the hierarchy. There should be a way to name things that makes sense so that they are still straightforward to sort and report.
- Sets of nodes
- If you choose “Yes” for Group Node, the area will become a parent (group) node. This indicates that it can have more sub-territories below it, but you can’t pick it directly in transactions or linked documents.
- If you set Group Node to No, the territory will become a leaf (child) node. Leaf nodes are at the bottom of the hierarchy, and you can only choose them in masters and transactional documents like Customers, Sales Orders, and Invoices.
You can only choose territories that aren’t in a group in other masters and transactions. This keeps the data the same and stops transactions from travelling to high-level grouping nodes.
In the tree view, this is what Child Territories look like under a Parent Territory: To show the child territories of a parent node, click on it. This makes it easy to see the hierarchy and adjust or manage regions as your organization expands.
In ERPNext v16, you may now control other tree-based masters like the Chart of Accounts, Cost Centres, Customer Groups, and Item Groups. To achieve this, follow these steps. All tree masters utilize the same rules to choose the order of parent-child relationships, group nodes, and leaf nodes. This makes it easy to keep your ERP data arranged in a way that is sturdy and stable.
Set default values for any field
In ERPNext v16, you may establish default values for fields. This implies that when you create a new document, it will automatically fill in the fields with information that is regularly used. This makes things more consistent, reduces down on the need to enter the same information again and over, and speeds up daily operations. You don’t need to write any code to set default settings for a DocType. You may utilize the built-in customization tools.
The Customize Form feature lets you set a default value for almost any field in any DocType in ERPNext. This default value will be used every time a new document of that DocType is produced, unless someone changes it by manually or by following other system rules, such user defaults or corporate defaults.
Steps:
1. You may locate the Customize Form option in the Awesome Search Bar or in the Menu of any DocType. The Customize Form screen will open, where you may examine and alter all the fields that make up the selected DocType. This interface in ERPNext v16 also makes it simple to identify and understand field features such as visibility, needed status, permissions, and default settings.
2. If you make the field bigger, you can save a default value for it. Find the Default field in the Display section and type in the value you wish to be the default. Depending on the type of field and how it will be utilised, this value could be a fixed value (like the name of a warehouse), a number, or even a dynamic expression.
In the GIF below, we set the default value for the “Default Source Warehouse” field in the DocType Stock Entry to “Stores – ETL.” With this setup in ERPNext v16, any new Stock Entry will automatically pick Stores – ETL as the source warehouse. This saves time and makes it less likely that you’ll make a mistake by hand.