I am writing a code for filters.I want to add filters for a report where do i add them? In which report type should i add the filter code? Help.I am new to ERP
crafter
October 18, 2019, 5:15am
#2
Look at the documentation for script report. The filters are in a file ____.js
As an example, go to the directory
frappe-bench/apps/erpnext/selling/report/inactive_customers
You will see a few files
$ ls -lt
drwxr-xr-x 2 erpnext erpnext 4096 Oct 13 11:33 __pycache__
-rw-r--r-- 1 erpnext erpnext 477 Oct 12 08:23 inactive_customers.js
-rw-r--r-- 1 erpnext erpnext 655 Oct 12 08:23 inactive_customers.json
-rw-r--r-- 1 erpnext erpnext 2411 Oct 12 08:23 inactive_customers.py
-rw-r--r-- 1 erpnext erpnext 2411 Oct 12 08:23 inactive_customers.html
-rw-r--r-- 1 pradesh pradesh 0 Oct 12 08:23 __init__.py
The .js file contains details of the report filter
The .py file contains the logic required to load the report data.
@Ashutosh_Halape you can refer general ledger.
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.query_reports["General Ledger"] = {
"filters": [
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company"),
"reqd": 1
},
{
"fieldname":"finance_book",
"label": __("Finance Book"),
"fieldtype": "Link",
"options": "Finance Book"
},
{
This file has been truncated. show original
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from collections import OrderedDict
import frappe
from frappe import _, _dict
from frappe.utils import cstr, getdate
from erpnext import get_company_currency, get_default_company
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
get_accounting_dimensions,
get_dimension_with_children,
)
from erpnext.accounts.report.financial_statements import get_cost_centers_with_children
from erpnext.accounts.report.utils import convert_to_presentation_currency, get_currency
from erpnext.accounts.utils import get_account_currency
# to cache translations
This file has been truncated. show original
@crafter how do I create a ____.js file ??
crafter
October 18, 2019, 8:42am
#5