From b095d0a0c51844eec9d84fddb95813969b83a3a2 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Fri, 14 Jun 2019 12:02:36 +0530 Subject: [PATCH] fix: GSTR-2 Report fixes (#17903) --- erpnext/regional/report/gstr_1/gstr_1.py | 5 ++++- erpnext/regional/report/gstr_2/gstr_2.py | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py index a6de94a9da..9d8fa2ae53 100644 --- a/erpnext/regional/report/gstr_1/gstr_1.py +++ b/erpnext/regional/report/gstr_1/gstr_1.py @@ -209,7 +209,10 @@ class Gstr1Report(object): sum(i.get('base_net_amount', 0) for i in items if i.item_code == d.item_code and i.parent == d.parent)) - item_tax_rate = json.loads(d.item_tax_rate) + item_tax_rate = {} + + if d.item_tax_rate: + item_tax_rate = json.loads(d.item_tax_rate) if item_tax_rate: self.item_tax_rate.setdefault(d.parent, {}).setdefault(d.item_code, item_tax_rate) diff --git a/erpnext/regional/report/gstr_2/gstr_2.py b/erpnext/regional/report/gstr_2/gstr_2.py index a362269007..d9cab63fef 100644 --- a/erpnext/regional/report/gstr_2/gstr_2.py +++ b/erpnext/regional/report/gstr_2/gstr_2.py @@ -43,8 +43,11 @@ class Gstr2Report(Gstr1Report): self.get_igst_invoices() 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(): - row, taxable_value = self.get_row_data_for_invoice(inv, invoice_details, rate, items) + for key, items in items_based_on_rate.items(): + rate = key[0] + account = key[1] + + row, taxable_value = self.get_row_data_for_invoice(inv, invoice_details, rate, account, items) tax_amount = taxable_value * rate / 100 if inv in self.igst_invoices: row += [tax_amount, 0, 0]