Merge pull request #21788 from deepeshgarg007/gst_instate_v13

fix: Instate Invoice not appearing in GSTR-1 report
diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py
index fd1cc58..dd5bb4a 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.py
+++ b/erpnext/regional/report/gstr_1/gstr_1.py
@@ -60,6 +60,9 @@
 			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():
+					if inv in self.cgst_igst_invoices:
+						rate = rate/2
+
 					row, taxable_value = self.get_row_data_for_invoice(inv, invoice_details, rate, items)
 
 					if self.filters.get("type_of_business") ==  "CDNR":
@@ -118,11 +121,11 @@
 				row.append(invoice_details.get(fieldname))
 		taxable_value = 0
 		for item_code, net_amount in self.invoice_items.get(invoice).items():
-				if item_code in items:
-					if self.item_tax_rate.get(invoice) and tax_rate in self.item_tax_rate.get(invoice, {}).get(item_code, []):
-						taxable_value += abs(net_amount)
-					elif not self.item_tax_rate.get(invoice):
-						taxable_value += abs(net_amount)
+			if item_code in items:
+				if self.item_tax_rate.get(invoice) and tax_rate in self.item_tax_rate.get(invoice, {}).get(item_code, []):
+					taxable_value += abs(net_amount)
+				elif not self.item_tax_rate.get(invoice):
+					taxable_value += abs(net_amount)
 
 		row += [tax_rate or 0, taxable_value]
 
@@ -196,7 +199,7 @@
 			if d.item_code not in self.invoice_items.get(d.parent, {}):
 				self.invoice_items.setdefault(d.parent, {}).setdefault(d.item_code,
 					sum(i.get('base_net_amount', 0) for i in items
-					    if i.item_code == d.item_code and i.parent == d.parent))
+						if i.item_code == d.item_code and i.parent == d.parent))
 
 				item_tax_rate = {}
 
@@ -221,6 +224,8 @@
 
 		self.items_based_on_tax_rate = {}
 		self.invoice_cess = frappe._dict()
+		self.cgst_igst_invoices = []
+
 		unidentified_gst_accounts = []
 		for parent, account, item_wise_tax_detail, tax_amount in self.tax_details:
 			if account in self.gst_accounts.cess_account:
@@ -243,6 +248,8 @@
 							tax_rate = tax_amounts[0]
 							if cgst_or_sgst:
 								tax_rate *= 2
+								if parent not in self.cgst_igst_invoices:
+									self.cgst_igst_invoices.append(parent)
 
 							rate_based_dict = self.items_based_on_tax_rate\
 								.setdefault(parent, {}).setdefault(tax_rate, [])