Minor fixes in gstr reports (#12848)

This commit is contained in:
Nabin Hait 2018-02-09 15:30:55 +05:30 committed by GitHub
parent 2bdc4ce70d
commit b0819b528f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -12,6 +12,8 @@ def execute(filters=None):
class Gstr1Report(object): class Gstr1Report(object):
def __init__(self, filters=None): def __init__(self, filters=None):
self.filters = frappe._dict(filters or {}) self.filters = frappe._dict(filters or {})
self.columns = []
self.data = []
self.doctype = "Sales Invoice" self.doctype = "Sales Invoice"
self.tax_doctype = "Sales Taxes and Charges" self.tax_doctype = "Sales Taxes and Charges"
self.select_columns = """ self.select_columns = """
@ -41,16 +43,15 @@ class Gstr1Report(object):
self.get_gst_accounts() self.get_gst_accounts()
self.get_invoice_data() 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 return self.columns, self.data
def get_data(self): def get_data(self):
self.data = []
for inv, items_based_on_rate in self.items_based_on_tax_rate.items(): for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
invoice_details = self.invoices.get(inv) invoice_details = self.invoices.get(inv)
for rate, items in items_based_on_rate.items(): for rate, items in items_based_on_rate.items():

View File

@ -12,6 +12,8 @@ def execute(filters=None):
class Gstr2Report(Gstr1Report): class Gstr2Report(Gstr1Report):
def __init__(self, filters=None): def __init__(self, filters=None):
self.filters = frappe._dict(filters or {}) self.filters = frappe._dict(filters or {})
self.columns = []
self.data = []
self.doctype = "Purchase Invoice" self.doctype = "Purchase Invoice"
self.tax_doctype = "Purchase Taxes and Charges" self.tax_doctype = "Purchase Taxes and Charges"
self.select_columns = """ self.select_columns = """
@ -39,7 +41,6 @@ class Gstr2Report(Gstr1Report):
def get_data(self): def get_data(self):
self.get_igst_invoices() self.get_igst_invoices()
self.data = []
for inv, items_based_on_rate in self.items_based_on_tax_rate.items(): for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
invoice_details = self.invoices.get(inv) invoice_details = self.invoices.get(inv)
for rate, items in items_based_on_rate.items(): for rate, items in items_based_on_rate.items():