[minor] Modified GSTR1 report to identify missing GST Account in GST Settings (#12426)
* [minor] Modified GSTR1 report to identify missing GST Account in GST Settings * Update gstr_1.py
This commit is contained in:
parent
8be6d74655
commit
a48f69eb83
@ -29,12 +29,12 @@ def get_itemised_tax_breakup_header(item_doctype, tax_accounts):
|
|||||||
return [_("HSN/SAC"), _("Taxable Amount")] + tax_accounts
|
return [_("HSN/SAC"), _("Taxable Amount")] + tax_accounts
|
||||||
else:
|
else:
|
||||||
return [_("Item"), _("Taxable Amount")] + tax_accounts
|
return [_("Item"), _("Taxable Amount")] + tax_accounts
|
||||||
|
|
||||||
def get_itemised_tax_breakup_data(doc):
|
def get_itemised_tax_breakup_data(doc):
|
||||||
itemised_tax = get_itemised_tax(doc.taxes)
|
itemised_tax = get_itemised_tax(doc.taxes)
|
||||||
|
|
||||||
itemised_taxable_amount = get_itemised_taxable_amount(doc.items)
|
itemised_taxable_amount = get_itemised_taxable_amount(doc.items)
|
||||||
|
|
||||||
if not frappe.get_meta(doc.doctype + " Item").has_field('gst_hsn_code'):
|
if not frappe.get_meta(doc.doctype + " Item").has_field('gst_hsn_code'):
|
||||||
return itemised_tax, itemised_taxable_amount
|
return itemised_tax, itemised_taxable_amount
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ def set_place_of_supply(doc, method):
|
|||||||
|
|
||||||
address_name = doc.shipping_address_name or doc.customer_address
|
address_name = doc.shipping_address_name or doc.customer_address
|
||||||
address = frappe.db.get_value("Address", address_name, ["gst_state", "gst_state_number"], as_dict=1)
|
address = frappe.db.get_value("Address", address_name, ["gst_state", "gst_state_number"], as_dict=1)
|
||||||
doc.place_of_supply = address.gst_state_number + "-" + address.gst_state
|
doc.place_of_supply = str(address.gst_state_number) + "-" + address.gst_state
|
||||||
|
|
||||||
# don't remove this function it is used in tests
|
# don't remove this function it is used in tests
|
||||||
def test_method():
|
def test_method():
|
||||||
|
@ -24,7 +24,7 @@ def get_columns(filters):
|
|||||||
"Taxable Value:Currency:120",
|
"Taxable Value:Currency:120",
|
||||||
"Cess Amount:Currency:120"
|
"Cess Amount:Currency:120"
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_data(filters):
|
def get_data(filters):
|
||||||
gst_accounts = get_gst_accounts(filters)
|
gst_accounts = get_gst_accounts(filters)
|
||||||
invoices = get_invoice_data(filters)
|
invoices = get_invoice_data(filters)
|
||||||
@ -120,7 +120,7 @@ def get_invoice_items(invoices):
|
|||||||
for d in items:
|
for d in items:
|
||||||
invoice_items.setdefault(d.parent, {}).setdefault(d.item_code, d.base_net_amount)
|
invoice_items.setdefault(d.parent, {}).setdefault(d.item_code, d.base_net_amount)
|
||||||
return invoice_items
|
return invoice_items
|
||||||
|
|
||||||
def get_items_based_on_tax_rate(invoices, gst_accounts):
|
def get_items_based_on_tax_rate(invoices, gst_accounts):
|
||||||
tax_details = frappe.db.sql("""
|
tax_details = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
@ -135,6 +135,7 @@ def get_items_based_on_tax_rate(invoices, gst_accounts):
|
|||||||
|
|
||||||
items_based_on_tax_rate = {}
|
items_based_on_tax_rate = {}
|
||||||
invoice_cess = frappe._dict()
|
invoice_cess = frappe._dict()
|
||||||
|
unidentified_gst_accounts = []
|
||||||
|
|
||||||
for parent, account, item_wise_tax_detail, tax_amount in tax_details:
|
for parent, account, item_wise_tax_detail, tax_amount in tax_details:
|
||||||
if account in gst_accounts.cess_account:
|
if account in gst_accounts.cess_account:
|
||||||
@ -147,15 +148,25 @@ def get_items_based_on_tax_rate(invoices, gst_accounts):
|
|||||||
if account in gst_accounts.cgst_account or account in gst_accounts.sgst_account:
|
if account in gst_accounts.cgst_account or account in gst_accounts.sgst_account:
|
||||||
cgst_or_sgst = True
|
cgst_or_sgst = True
|
||||||
|
|
||||||
|
if not (cgst_or_sgst or account in gst_accounts.igst_account):
|
||||||
|
if "gst" in account.lower() and account not in unidentified_gst_accounts:
|
||||||
|
unidentified_gst_accounts.append(account)
|
||||||
|
continue
|
||||||
|
|
||||||
for item_code, tax_amounts in item_wise_tax_detail.items():
|
for item_code, tax_amounts in item_wise_tax_detail.items():
|
||||||
tax_rate = tax_amounts[0]
|
tax_rate = tax_amounts[0]
|
||||||
if cgst_or_sgst:
|
if cgst_or_sgst:
|
||||||
tax_rate *= 2
|
tax_rate *= 2
|
||||||
|
|
||||||
rate_based_dict = items_based_on_tax_rate.setdefault(parent, {}).setdefault(tax_rate, [])
|
rate_based_dict = items_based_on_tax_rate.setdefault(parent, {})\
|
||||||
|
.setdefault(tax_rate, [])
|
||||||
if item_code not in rate_based_dict:
|
if item_code not in rate_based_dict:
|
||||||
rate_based_dict.append(item_code)
|
rate_based_dict.append(item_code)
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
return items_based_on_tax_rate, invoice_cess
|
if unidentified_gst_accounts:
|
||||||
|
frappe.msgprint(_("Following accounts might be selected in GST Settings:")
|
||||||
|
+ "<br>" + "<br>".join(unidentified_gst_accounts), alert=True)
|
||||||
|
|
||||||
|
return items_based_on_tax_rate, invoice_cess
|
||||||
|
Loading…
x
Reference in New Issue
Block a user