fix(GST): Do not add tax amount in grand total for reverse charge invoices
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 3cd57d4..c701a7c 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -438,6 +438,8 @@
self.make_tax_gl_entries(gl_entries)
+ gl_entries = make_regional_gl_entries(gl_entries, self)
+
gl_entries = merge_similar_entries(gl_entries)
self.make_payment_gl_entries(gl_entries)
@@ -1097,6 +1099,10 @@
})
return list_context
+@erpnext.allow_regional
+def make_regional_gl_entries(gl_entries, doc):
+ return gl_entries
+
@frappe.whitelist()
def make_debit_note(source_name, target_doc=None):
from erpnext.controllers.sales_and_purchase_return import make_return_doc
diff --git a/erpnext/accounts/doctype/purchase_invoice/regional/india.js b/erpnext/accounts/doctype/purchase_invoice/regional/india.js
index 81488a2..83cb03a 100644
--- a/erpnext/accounts/doctype/purchase_invoice/regional/india.js
+++ b/erpnext/accounts/doctype/purchase_invoice/regional/india.js
@@ -1,3 +1,33 @@
{% include "erpnext/regional/india/taxes.js" %}
erpnext.setup_auto_gst_taxation('Purchase Invoice');
+
+
+frappe.ui.form.on('Purchase Taxes and Charges', {
+ taxes_add: function(frm) {
+ if (frm.doc.reverse_charge === 'Y') {
+ frappe.call({
+ 'method': 'erpnext.regional.india.utils.get_gst_accounts',
+ 'args': {
+ company: frm.doc.company
+ },
+ 'callback': function(r) {
+ let accounts = r.message;
+ let account_list = accounts['cgst_account'] + accounts['sgst_account']
+ + accounts['igst_account']
+
+ let gst_tax = 0;
+
+ $.each(frm.doc.taxes || [], function(i, row) {
+ if (account_list.includes(row.account_head)) {
+ gst_tax += row.base_tax_amount_after_discount_amount;
+ }
+ });
+
+ frm.doc.taxes_and_charges_added -= flt(gst_tax);
+ frm.refresh_field('taxes_and_charges_added');
+ }
+ })
+ }
+ }
+});
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index bfe35ab..a1f8c03 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -20,6 +20,7 @@
if not cancel:
validate_accounting_period(gl_map)
gl_map = process_gl_map(gl_map, merge_entries)
+ print(gl_map, "$$$$$$$$$")
if gl_map and len(gl_map) > 1:
save_entries(gl_map, adv_adj, update_outstanding)
else: