From b0819b528fc27a4cd2de2f31339ee5ad7bff95a5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 9 Feb 2018 15:30:55 +0530 Subject: [PATCH] Minor fixes in gstr reports (#12848) --- erpnext/regional/report/gstr_1/gstr_1.py | 13 +++++++------ erpnext/regional/report/gstr_2/gstr_2.py | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py index 1ad673f289..4dd1300fc8 100644 --- a/erpnext/regional/report/gstr_1/gstr_1.py +++ b/erpnext/regional/report/gstr_1/gstr_1.py @@ -12,6 +12,8 @@ def execute(filters=None): class Gstr1Report(object): def __init__(self, filters=None): self.filters = frappe._dict(filters or {}) + self.columns = [] + self.data = [] self.doctype = "Sales Invoice" self.tax_doctype = "Sales Taxes and Charges" self.select_columns = """ @@ -41,16 +43,15 @@ class Gstr1Report(object): self.get_gst_accounts() self.get_invoice_data() - if not self.invoices: return + if self.invoices: + self.get_invoice_items() + self.get_items_based_on_tax_rate() + self.invoice_fields = [d["fieldname"] for d in self.invoice_columns] + self.get_data() - self.get_invoice_items() - self.get_items_based_on_tax_rate() - self.invoice_fields = [d["fieldname"] for d in self.invoice_columns] - self.get_data() return self.columns, self.data def get_data(self): - self.data = [] for inv, items_based_on_rate in self.items_based_on_tax_rate.items(): invoice_details = self.invoices.get(inv) for rate, items in items_based_on_rate.items(): diff --git a/erpnext/regional/report/gstr_2/gstr_2.py b/erpnext/regional/report/gstr_2/gstr_2.py index a69a67f53b..679e567d42 100644 --- a/erpnext/regional/report/gstr_2/gstr_2.py +++ b/erpnext/regional/report/gstr_2/gstr_2.py @@ -12,6 +12,8 @@ def execute(filters=None): class Gstr2Report(Gstr1Report): def __init__(self, filters=None): self.filters = frappe._dict(filters or {}) + self.columns = [] + self.data = [] self.doctype = "Purchase Invoice" self.tax_doctype = "Purchase Taxes and Charges" self.select_columns = """ @@ -39,7 +41,6 @@ class Gstr2Report(Gstr1Report): def get_data(self): self.get_igst_invoices() - self.data = [] for inv, items_based_on_rate in self.items_based_on_tax_rate.items(): invoice_details = self.invoices.get(inv) for rate, items in items_based_on_rate.items():