Compare commits

..

3 Commits

Author SHA1 Message Date
Deepesh Garg
b5bea473de fix: Remove print and debug
(cherry picked from commit 6dfcc1e2ae)

# Conflicts:
#	erpnext/regional/report/gstr_1/gstr_1.py
2025-02-26 00:15:39 +00:00
Deepesh Garg
0692593bf8 fix: GSTR-1 Reports not showing any data
(cherry picked from commit e1f55df4d7)

# Conflicts:
#	erpnext/regional/report/gstr_1/gstr_1.py
2025-02-26 00:15:39 +00:00
mergify[bot]
f5160dc83d fix: use Stock Qty while getting POS Reserved Qty (backport #38962) (#38983)
fix: use `Stock Qty` while getting `POS Reserved Qty`

(cherry picked from commit 7223106417)

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
2023-12-28 12:00:04 +05:30
3 changed files with 48 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ import frappe
from erpnext.hooks import regional_overrides
__version__ = "13.55.2"
__version__ = "13.54.4"
def get_default_company(user=None):

View File

@@ -704,7 +704,7 @@ def get_pos_reserved_qty(item_code, warehouse):
reserved_qty = (
frappe.qb.from_(p_inv)
.from_(p_item)
.select(Sum(p_item.qty).as_("qty"))
.select(Sum(p_item.stock_qty).as_("stock_qty"))
.where(
(p_inv.name == p_item.parent)
& (IfNull(p_inv.consolidated_invoice, "") == "")
@@ -715,7 +715,7 @@ def get_pos_reserved_qty(item_code, warehouse):
)
).run(as_dict=True)
return reserved_qty[0].qty or 0 if reserved_qty else 0
return flt(reserved_qty[0].stock_qty) if reserved_qty else 0
@frappe.whitelist()

View File

@@ -157,6 +157,7 @@ class Gstr1Report(object):
invoice_details = self.invoices.get(inv)
for rate, items in items_based_on_rate.items():
place_of_supply = invoice_details.get("place_of_supply")
<<<<<<< HEAD
ecommerce_gstin = invoice_details.get("ecommerce_gstin")
b2cs_output.setdefault(
@@ -173,11 +174,27 @@ class Gstr1Report(object):
"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["place_of_supply"] = place_of_supply
row["ecommerce_gstin"] = ecommerce_gstin
row["rate"] = rate
<<<<<<< HEAD
row["taxable_value"] += sum(
[
abs(net_amount)
@@ -185,6 +202,10 @@ class Gstr1Report(object):
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["type"] = "E" if ecommerce_gstin else "OE"
@@ -247,20 +268,40 @@ class Gstr1Report(object):
self.invoices = frappe._dict()
conditions = self.get_conditions()
<<<<<<< HEAD
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_columns}
from `tab{doctype}`
where docstatus = 1 {where_conditions}
and is_opening = 'No'
order by posting_date desc
<<<<<<< HEAD
""".format(
select_columns=self.select_columns, doctype=self.doctype, where_conditions=conditions
),
self.filters,
as_dict=1,
)
=======
""".format(select_columns=self.select_columns, doctype=self.doctype,
<<<<<<< HEAD
where_conditions=conditions), self.filters, as_dict=1, debug=1)
>>>>>>> e1f55df4d7 (fix: GSTR-1 Reports not showing any data)
=======
where_conditions=conditions), self.filters, as_dict=1)
>>>>>>> 6dfcc1e2ae (fix: Remove print and debug)
for d in invoice_data:
self.invoices.setdefault(d.invoice_number, d)
@@ -1108,7 +1149,11 @@ def get_company_gstin_number(company, address=None, all_gstins=False):
["Dynamic Link", "link_doctype", "=", "Company"],
["Dynamic Link", "link_name", "=", company],
["Dynamic Link", "parenttype", "=", "Address"],
<<<<<<< HEAD
["gstin", "!=", ""],
=======
["gstin", "!=", '']
>>>>>>> e1f55df4d7 (fix: GSTR-1 Reports not showing any data)
]
gstin = frappe.get_all(
"Address", filters=filters, pluck="gstin", order_by="is_primary_address desc"