Merge pull request #27373 from deepeshgarg007/gstin_filter_issue
fix: GSTR-1 Reports not showing any data
This commit is contained in:
commit
8f6d22b7ea
@ -96,35 +96,36 @@ class Gstr1Report(object):
|
|||||||
def get_b2c_data(self):
|
def get_b2c_data(self):
|
||||||
b2cs_output = {}
|
b2cs_output = {}
|
||||||
|
|
||||||
for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
|
if self.invoices:
|
||||||
invoice_details = self.invoices.get(inv)
|
for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
|
||||||
for rate, items in items_based_on_rate.items():
|
invoice_details = self.invoices.get(inv)
|
||||||
place_of_supply = invoice_details.get("place_of_supply")
|
for rate, items in items_based_on_rate.items():
|
||||||
ecommerce_gstin = invoice_details.get("ecommerce_gstin")
|
place_of_supply = invoice_details.get("place_of_supply")
|
||||||
|
ecommerce_gstin = invoice_details.get("ecommerce_gstin")
|
||||||
|
|
||||||
b2cs_output.setdefault((rate, place_of_supply, ecommerce_gstin),{
|
b2cs_output.setdefault((rate, place_of_supply, ecommerce_gstin), {
|
||||||
"place_of_supply": "",
|
"place_of_supply": "",
|
||||||
"ecommerce_gstin": "",
|
"ecommerce_gstin": "",
|
||||||
"rate": "",
|
"rate": "",
|
||||||
"taxable_value": 0,
|
"taxable_value": 0,
|
||||||
"cess_amount": 0,
|
"cess_amount": 0,
|
||||||
"type": "",
|
"type": "",
|
||||||
"invoice_number": invoice_details.get("invoice_number"),
|
"invoice_number": invoice_details.get("invoice_number"),
|
||||||
"posting_date": invoice_details.get("posting_date"),
|
"posting_date": invoice_details.get("posting_date"),
|
||||||
"invoice_value": invoice_details.get("base_grand_total"),
|
"invoice_value": invoice_details.get("base_grand_total"),
|
||||||
})
|
})
|
||||||
|
|
||||||
row = b2cs_output.get((rate, place_of_supply, ecommerce_gstin))
|
row = b2cs_output.get((rate, place_of_supply, ecommerce_gstin))
|
||||||
row["place_of_supply"] = place_of_supply
|
row["place_of_supply"] = place_of_supply
|
||||||
row["ecommerce_gstin"] = ecommerce_gstin
|
row["ecommerce_gstin"] = ecommerce_gstin
|
||||||
row["rate"] = rate
|
row["rate"] = rate
|
||||||
row["taxable_value"] += sum([abs(net_amount)
|
row["taxable_value"] += sum([abs(net_amount)
|
||||||
for item_code, net_amount in self.invoice_items.get(inv).items() if item_code in items])
|
for item_code, net_amount in self.invoice_items.get(inv).items() if item_code in items])
|
||||||
row["cess_amount"] += flt(self.invoice_cess.get(inv), 2)
|
row["cess_amount"] += flt(self.invoice_cess.get(inv), 2)
|
||||||
row["type"] = "E" if ecommerce_gstin else "OE"
|
row["type"] = "E" if ecommerce_gstin else "OE"
|
||||||
|
|
||||||
for key, value in iteritems(b2cs_output):
|
for key, value in iteritems(b2cs_output):
|
||||||
self.data.append(value)
|
self.data.append(value)
|
||||||
|
|
||||||
def get_row_data_for_invoice(self, invoice, invoice_details, tax_rate, items):
|
def get_row_data_for_invoice(self, invoice, invoice_details, tax_rate, items):
|
||||||
row = []
|
row = []
|
||||||
@ -173,9 +174,10 @@ class Gstr1Report(object):
|
|||||||
|
|
||||||
company_gstins = get_company_gstin_number(self.filters.get('company'), all_gstins=True)
|
company_gstins = get_company_gstin_number(self.filters.get('company'), all_gstins=True)
|
||||||
|
|
||||||
self.filters.update({
|
if company_gstins:
|
||||||
'company_gstins': company_gstins
|
self.filters.update({
|
||||||
})
|
'company_gstins': company_gstins
|
||||||
|
})
|
||||||
|
|
||||||
invoice_data = frappe.db.sql("""
|
invoice_data = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
@ -1050,6 +1052,7 @@ def get_company_gstin_number(company, address=None, all_gstins=False):
|
|||||||
["Dynamic Link", "link_doctype", "=", "Company"],
|
["Dynamic Link", "link_doctype", "=", "Company"],
|
||||||
["Dynamic Link", "link_name", "=", company],
|
["Dynamic Link", "link_name", "=", company],
|
||||||
["Dynamic Link", "parenttype", "=", "Address"],
|
["Dynamic Link", "parenttype", "=", "Address"],
|
||||||
|
["gstin", "!=", '']
|
||||||
]
|
]
|
||||||
gstin = frappe.get_all("Address", filters=filters, pluck="gstin", order_by="is_primary_address desc")
|
gstin = frappe.get_all("Address", filters=filters, pluck="gstin", order_by="is_primary_address desc")
|
||||||
if gstin and not all_gstins:
|
if gstin and not all_gstins:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user