Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(india): e-invoicing for intra-state union territory transactions #30626

Merged
merged 1 commit into from
Apr 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion erpnext/accounts/doctype/gst_account/gst_account.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"sgst_account",
"igst_account",
"cess_account",
"utgst_account",
"is_reverse_charge_account"
],
"fields": [
Expand Down Expand Up @@ -64,12 +65,18 @@
"fieldtype": "Check",
"in_list_view": 1,
"label": "Is Reverse Charge Account"
},
{
"fieldname": "utgst_account",
"fieldtype": "Link",
"label": "UTGST Account",
"options": "Account"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-04-09 12:30:25.889993",
"modified": "2022-04-07 12:59:14.039768",
"modified_by": "Administrator",
"module": "Accounts",
"name": "GST Account",
Expand All @@ -78,5 +85,6 @@
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
16 changes: 12 additions & 4 deletions erpnext/regional/india/e_invoice/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,14 @@ def update_item_taxes(invoice, item):
item.cess_rate += item_tax_rate
item.cess_amount += abs(item_tax_amount_after_discount)

for tax_type in ["igst", "cgst", "sgst"]:
for tax_type in ["igst", "cgst", "sgst", "utgst"]:
if t.account_head in gst_accounts[f"{tax_type}_account"]:
item.tax_rate += item_tax_rate
item[f"{tax_type}_amount"] += abs(item_tax_amount)
if tax_type == "utgst":
# utgst taxes are reported same as sgst tax
item["sgst_amount"] += abs(item_tax_amount)
else:
item[f"{tax_type}_amount"] += abs(item_tax_amount)
else:
# TODO: other charges per item
pass
Expand Down Expand Up @@ -359,11 +363,15 @@ def update_invoice_taxes(invoice, invoice_value_details):
# using after discount amt since item also uses after discount amt for cess calc
invoice_value_details.total_cess_amt += abs(t.base_tax_amount_after_discount_amount)

for tax_type in ["igst", "cgst", "sgst"]:
for tax_type in ["igst", "cgst", "sgst", "utgst"]:
if t.account_head in gst_accounts[f"{tax_type}_account"]:
if tax_type == "utgst":
invoice_value_details["total_sgst_amt"] += abs(tax_amount)
else:
invoice_value_details[f"total_{tax_type}_amt"] += abs(tax_amount)

invoice_value_details[f"total_{tax_type}_amt"] += abs(tax_amount)
update_other_charges(t, invoice_value_details, gst_accounts_list, invoice, considered_rows)

else:
invoice_value_details.total_other_charges += abs(tax_amount)

Expand Down
2 changes: 1 addition & 1 deletion erpnext/regional/india/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ def get_gst_accounts(
gst_settings_accounts = frappe.get_all(
"GST Account",
filters=filters,
fields=["cgst_account", "sgst_account", "igst_account", "cess_account"],
fields=["cgst_account", "sgst_account", "igst_account", "cess_account", "utgst_account"],
)

if not gst_settings_accounts and not frappe.flags.in_test and not frappe.flags.in_migrate:
Expand Down