Merge pull request #25969 from deepeshgarg007/inernal_transfer_invoices_ignore
fix: Ignore internal transfer invoices from GST Reports
This commit is contained in:
commit
bf5f87c2fe
@ -147,6 +147,13 @@ class Gstr1Report(object):
|
|||||||
def get_invoice_data(self):
|
def get_invoice_data(self):
|
||||||
self.invoices = frappe._dict()
|
self.invoices = frappe._dict()
|
||||||
conditions = self.get_conditions()
|
conditions = self.get_conditions()
|
||||||
|
|
||||||
|
company_gstins = get_company_gstin_number(self.filters.get('company'), all_gstins=True)
|
||||||
|
|
||||||
|
self.filters.update({
|
||||||
|
'company_gstins': company_gstins
|
||||||
|
})
|
||||||
|
|
||||||
invoice_data = frappe.db.sql("""
|
invoice_data = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
{select_columns}
|
{select_columns}
|
||||||
@ -193,6 +200,9 @@ class Gstr1Report(object):
|
|||||||
|
|
||||||
elif self.filters.get("type_of_business") == "EXPORT":
|
elif self.filters.get("type_of_business") == "EXPORT":
|
||||||
conditions += """ AND is_return !=1 and gst_category = 'Overseas' """
|
conditions += """ AND is_return !=1 and gst_category = 'Overseas' """
|
||||||
|
|
||||||
|
conditions += " AND billing_address_gstin NOT IN %(company_gstins)s"
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
def get_invoice_items(self):
|
def get_invoice_items(self):
|
||||||
@ -810,7 +820,8 @@ def get_rate_and_tax_details(row, gstin):
|
|||||||
|
|
||||||
return {"num": int(num), "itm_det": itm_det}
|
return {"num": int(num), "itm_det": itm_det}
|
||||||
|
|
||||||
def get_company_gstin_number(company, address=None):
|
def get_company_gstin_number(company, address=None, all_gstins=False):
|
||||||
|
gstin = ''
|
||||||
if address:
|
if address:
|
||||||
gstin = frappe.db.get_value("Address", address, "gstin")
|
gstin = frappe.db.get_value("Address", address, "gstin")
|
||||||
|
|
||||||
@ -822,9 +833,9 @@ def get_company_gstin_number(company, address=None):
|
|||||||
["Dynamic Link", "parenttype", "=", "Address"],
|
["Dynamic Link", "parenttype", "=", "Address"],
|
||||||
]
|
]
|
||||||
gstin = frappe.get_all("Address", filters=filters, pluck="gstin")
|
gstin = frappe.get_all("Address", filters=filters, pluck="gstin")
|
||||||
if gstin:
|
if gstin and not all_gstins:
|
||||||
gstin[0]
|
gstin = gstin[0]
|
||||||
|
|
||||||
if not gstin:
|
if not gstin:
|
||||||
address = frappe.bold(address) if address else ""
|
address = frappe.bold(address) if address else ""
|
||||||
frappe.throw(_("Please set valid GSTIN No. in Company Address {} for company {}").format(
|
frappe.throw(_("Please set valid GSTIN No. in Company Address {} for company {}").format(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user