[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:
Vishal Dhayagude 2018-01-11 12:26:52 +05:30 committed by Nabin Hait
parent 8be6d74655
commit a48f69eb83
2 changed files with 18 additions and 7 deletions

View File

@ -66,7 +66,7 @@ def set_place_of_supply(doc, method):
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)
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
def test_method():

View File

@ -135,6 +135,7 @@ def get_items_based_on_tax_rate(invoices, gst_accounts):
items_based_on_tax_rate = {}
invoice_cess = frappe._dict()
unidentified_gst_accounts = []
for parent, account, item_wise_tax_detail, tax_amount in tax_details:
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:
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():
tax_rate = tax_amounts[0]
if cgst_or_sgst:
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:
rate_based_dict.append(item_code)
except ValueError:
continue
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