mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 15:09:20 +00:00
fix: GSTR-1 Reports not showing any data
(cherry picked from commit e1f55df4d7)
# Conflicts:
# erpnext/regional/report/gstr_1/gstr_1.py
This commit is contained in:
@@ -51,6 +51,7 @@ class Gstr1Report(object):
|
|||||||
self.gst_accounts = get_gst_accounts(self.filters.company, only_non_reverse_charge=1)
|
self.gst_accounts = get_gst_accounts(self.filters.company, only_non_reverse_charge=1)
|
||||||
self.get_invoice_data()
|
self.get_invoice_data()
|
||||||
|
|
||||||
|
print(self.invoices, "$#$#$#$#$#")
|
||||||
if self.invoices:
|
if self.invoices:
|
||||||
self.get_invoice_items()
|
self.get_invoice_items()
|
||||||
self.get_items_based_on_tax_rate()
|
self.get_items_based_on_tax_rate()
|
||||||
@@ -157,6 +158,7 @@ class Gstr1Report(object):
|
|||||||
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():
|
||||||
place_of_supply = invoice_details.get("place_of_supply")
|
place_of_supply = invoice_details.get("place_of_supply")
|
||||||
|
<<<<<<< HEAD
|
||||||
ecommerce_gstin = invoice_details.get("ecommerce_gstin")
|
ecommerce_gstin = invoice_details.get("ecommerce_gstin")
|
||||||
|
|
||||||
b2cs_output.setdefault(
|
b2cs_output.setdefault(
|
||||||
@@ -173,11 +175,27 @@ class Gstr1Report(object):
|
|||||||
"invoice_value": invoice_details.get("base_grand_total"),
|
"invoice_value": invoice_details.get("base_grand_total"),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
=======
|
||||||
|
ecommerce_gstin = invoice_details.get("ecommerce_gstin")
|
||||||
|
|
||||||
|
b2cs_output.setdefault((rate, place_of_supply, ecommerce_gstin), {
|
||||||
|
"place_of_supply": "",
|
||||||
|
"ecommerce_gstin": "",
|
||||||
|
"rate": "",
|
||||||
|
"taxable_value": 0,
|
||||||
|
"cess_amount": 0,
|
||||||
|
"type": "",
|
||||||
|
"invoice_number": invoice_details.get("invoice_number"),
|
||||||
|
"posting_date": invoice_details.get("posting_date"),
|
||||||
|
"invoice_value": invoice_details.get("base_grand_total"),
|
||||||
|
})
|
||||||
|
>>>>>>> e1f55df4d7 (fix: GSTR-1 Reports not showing any data)
|
||||||
|
|
||||||
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
|
||||||
|
<<<<<<< HEAD
|
||||||
row["taxable_value"] += sum(
|
row["taxable_value"] += sum(
|
||||||
[
|
[
|
||||||
abs(net_amount)
|
abs(net_amount)
|
||||||
@@ -185,6 +203,10 @@ class Gstr1Report(object):
|
|||||||
if item_code in items
|
if item_code in items
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
=======
|
||||||
|
row["taxable_value"] += sum([abs(net_amount)
|
||||||
|
for item_code, net_amount in self.invoice_items.get(inv).items() if item_code in items])
|
||||||
|
>>>>>>> e1f55df4d7 (fix: GSTR-1 Reports not showing any data)
|
||||||
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"
|
||||||
|
|
||||||
@@ -247,20 +269,36 @@ class Gstr1Report(object):
|
|||||||
self.invoices = frappe._dict()
|
self.invoices = frappe._dict()
|
||||||
conditions = self.get_conditions()
|
conditions = self.get_conditions()
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
invoice_data = frappe.db.sql(
|
invoice_data = frappe.db.sql(
|
||||||
"""
|
"""
|
||||||
|
=======
|
||||||
|
company_gstins = get_company_gstin_number(self.filters.get('company'), all_gstins=True)
|
||||||
|
|
||||||
|
if company_gstins:
|
||||||
|
self.filters.update({
|
||||||
|
'company_gstins': company_gstins
|
||||||
|
})
|
||||||
|
|
||||||
|
invoice_data = frappe.db.sql("""
|
||||||
|
>>>>>>> e1f55df4d7 (fix: GSTR-1 Reports not showing any data)
|
||||||
select
|
select
|
||||||
{select_columns}
|
{select_columns}
|
||||||
from `tab{doctype}`
|
from `tab{doctype}`
|
||||||
where docstatus = 1 {where_conditions}
|
where docstatus = 1 {where_conditions}
|
||||||
and is_opening = 'No'
|
and is_opening = 'No'
|
||||||
order by posting_date desc
|
order by posting_date desc
|
||||||
|
<<<<<<< HEAD
|
||||||
""".format(
|
""".format(
|
||||||
select_columns=self.select_columns, doctype=self.doctype, where_conditions=conditions
|
select_columns=self.select_columns, doctype=self.doctype, where_conditions=conditions
|
||||||
),
|
),
|
||||||
self.filters,
|
self.filters,
|
||||||
as_dict=1,
|
as_dict=1,
|
||||||
)
|
)
|
||||||
|
=======
|
||||||
|
""".format(select_columns=self.select_columns, doctype=self.doctype,
|
||||||
|
where_conditions=conditions), self.filters, as_dict=1, debug=1)
|
||||||
|
>>>>>>> e1f55df4d7 (fix: GSTR-1 Reports not showing any data)
|
||||||
|
|
||||||
for d in invoice_data:
|
for d in invoice_data:
|
||||||
self.invoices.setdefault(d.invoice_number, d)
|
self.invoices.setdefault(d.invoice_number, d)
|
||||||
@@ -1108,7 +1146,11 @@ 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"],
|
||||||
|
<<<<<<< HEAD
|
||||||
["gstin", "!=", ""],
|
["gstin", "!=", ""],
|
||||||
|
=======
|
||||||
|
["gstin", "!=", '']
|
||||||
|
>>>>>>> e1f55df4d7 (fix: GSTR-1 Reports not showing any data)
|
||||||
]
|
]
|
||||||
gstin = frappe.get_all(
|
gstin = frappe.get_all(
|
||||||
"Address", filters=filters, pluck="gstin", order_by="is_primary_address desc"
|
"Address", filters=filters, pluck="gstin", order_by="is_primary_address desc"
|
||||||
|
|||||||
Reference in New Issue
Block a user