diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py index 96c55ff625..79d6e12bfb 100644 --- a/erpnext/regional/report/gstr_1/gstr_1.py +++ b/erpnext/regional/report/gstr_1/gstr_1.py @@ -109,8 +109,8 @@ class Gstr1Report(object): customers = frappe.get_all("Customer", filters={"customer_type": self.customer_type}) if self.filters.get("type_of_business") == "B2B": - conditions += " and invoice_type != 'Export' and is_return != 1 and customer in ('{0}')".\ - format("', '".join([frappe.db.escape(c.name) for c in customers])) + conditions += """ and ifnull(invoice_type, '') != 'Export' and is_return != 1 + and customer in ('{0}')""".format("', '".join([frappe.db.escape(c.name) for c in customers])) if self.filters.get("type_of_business") in ("B2C Large", "B2C Small"): b2c_limit = frappe.db.get_single_value('GSt Settings', 'b2c_limit') diff --git a/erpnext/regional/report/gstr_2/gstr_2.py b/erpnext/regional/report/gstr_2/gstr_2.py index 679e567d42..0a2e96878f 100644 --- a/erpnext/regional/report/gstr_2/gstr_2.py +++ b/erpnext/regional/report/gstr_2/gstr_2.py @@ -84,7 +84,7 @@ class Gstr2Report(Gstr1Report): conditions += opts[1] if self.filters.get("type_of_business") == "B2B": - conditions += "and invoice_type != 'Export' and is_return != 1 " + conditions += "and ifnull(invoice_type, '') != 'Export' and is_return != 1 " elif self.filters.get("type_of_business") == "CDNR": conditions += """ and is_return = 1 """