From c55f774fbf415be88d227a1fe578a8ee96408dc1 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Thu, 31 May 2018 09:33:36 +0530 Subject: [PATCH] Address filter in gstr1 report (#14290) --- erpnext/regional/report/gstr_1/gstr_1.js | 15 +++++++++++++++ erpnext/regional/report/gstr_1/gstr_1.py | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/erpnext/regional/report/gstr_1/gstr_1.js b/erpnext/regional/report/gstr_1/gstr_1.js index 3a635277e4..b2c8aed6e3 100644 --- a/erpnext/regional/report/gstr_1/gstr_1.js +++ b/erpnext/regional/report/gstr_1/gstr_1.js @@ -11,6 +11,21 @@ frappe.query_reports["GSTR-1"] = { "reqd": 1, "default": frappe.defaults.get_user_default("Company") }, + { + "fieldname":"company_address", + "label": __("Address"), + "fieldtype": "Link", + "options": "Address", + "get_query": function() { + var company = frappe.query_report_filters_by_name.company.get_value(); + if (company) { + return { + "query": 'frappe.contacts.doctype.address.address.address_query', + "filters": { link_doctype: 'Company', link_name: company} + }; + } + } + }, { "fieldname":"from_date", "label": __("From Date"), diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py index 2c128e73ae..690fbbcb3a 100644 --- a/erpnext/regional/report/gstr_1/gstr_1.py +++ b/erpnext/regional/report/gstr_1/gstr_1.py @@ -102,7 +102,8 @@ class Gstr1Report(object): for opts in (("company", " and company=%(company)s"), ("from_date", " and posting_date>=%(from_date)s"), - ("to_date", " and posting_date<=%(to_date)s")): + ("to_date", " and posting_date<=%(to_date)s"), + ("company_address", " and company_address=%(company_address)s")): if self.filters.get(opts[0]): conditions += opts[1]