[fix] Fetch correct Tax Details
This commit is contained in:
parent
98e33c31cd
commit
e03e4a581f
@ -491,3 +491,4 @@ erpnext.patches.v10_0.update_assessment_result
|
|||||||
erpnext.patches.v10_0.added_extra_gst_custom_field
|
erpnext.patches.v10_0.added_extra_gst_custom_field
|
||||||
erpnext.patches.v10_0.workflow_leave_application #2018-01-24
|
erpnext.patches.v10_0.workflow_leave_application #2018-01-24
|
||||||
erpnext.patches.v10_0.set_default_payment_terms_based_on_company
|
erpnext.patches.v10_0.set_default_payment_terms_based_on_company
|
||||||
|
erpnext.patches.v10_0.added_extra_gst_custom_field_in_gstr2
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
import frappe
|
||||||
|
from erpnext.regional.india.setup import make_custom_fields
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
company = frappe.get_all('Company', filters = {'country': 'India'})
|
||||||
|
if not company:
|
||||||
|
return
|
||||||
|
|
||||||
|
make_custom_fields()
|
@ -32,9 +32,9 @@ class Gstr2Report(object):
|
|||||||
|
|
||||||
for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
|
for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
|
||||||
invoice_details = self.invoices.get(inv)
|
invoice_details = self.invoices.get(inv)
|
||||||
for x in xrange(1,10):
|
|
||||||
print(invoice_details)
|
|
||||||
for rate, items in items_based_on_rate.items():
|
for rate, items in items_based_on_rate.items():
|
||||||
|
# for is_igst, items in account.items():
|
||||||
row = []
|
row = []
|
||||||
for fieldname in invoice_fields:
|
for fieldname in invoice_fields:
|
||||||
if fieldname == "invoice_value":
|
if fieldname == "invoice_value":
|
||||||
@ -42,13 +42,23 @@ class Gstr2Report(object):
|
|||||||
else:
|
else:
|
||||||
row.append(invoice_details.get(fieldname))
|
row.append(invoice_details.get(fieldname))
|
||||||
|
|
||||||
|
print("items", items.items())
|
||||||
|
|
||||||
|
# for k, v in items.items():
|
||||||
|
# print(k,v[1], items.items().)
|
||||||
row += [rate,
|
row += [rate,
|
||||||
sum([net_amount for item_code, net_amount in self.invoice_items.get(inv).items()
|
sum([net_amount for item_code, net_amount in self.invoice_items.get(inv).items()
|
||||||
if item_code in items]),
|
if item_code in [v[0] for k, v in items.items()]]),
|
||||||
|
[v[1] if k == True else 0.00 for k, v in items.items()],
|
||||||
|
[v[1] if k == False else 0.00 for k, v in items.items()],
|
||||||
|
[v[1] if k == False else 0.00 for k, v in items.items()],
|
||||||
|
# [x for x in items if is_igst == False],
|
||||||
self.invoice_cess.get(inv),
|
self.invoice_cess.get(inv),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if self.filters.get("type_of_business") == "CDNR":
|
if self.filters.get("type_of_business") == "CDNR":
|
||||||
row.append("Y" if invoice_details.posting_date <= date(2017, 7, 1) else "N")
|
row.append("Y" if invoice_details.posting_date <= date(2017, 7, 1) else "N")
|
||||||
row.append("C" if invoice_details.return_against else "R")
|
row.append("C" if invoice_details.return_against else "R")
|
||||||
@ -152,16 +162,24 @@ class Gstr2Report(object):
|
|||||||
if "gst" in account.lower() and account not in unidentified_gst_accounts:
|
if "gst" in account.lower() and account not in unidentified_gst_accounts:
|
||||||
unidentified_gst_accounts.append(account)
|
unidentified_gst_accounts.append(account)
|
||||||
continue
|
continue
|
||||||
|
is_igst = False
|
||||||
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]
|
||||||
|
tax_amt = tax_amounts[1]
|
||||||
if cgst_or_sgst:
|
if cgst_or_sgst:
|
||||||
tax_rate *= 2
|
tax_rate *= 2
|
||||||
|
tax_amt *= 2
|
||||||
|
|
||||||
|
else:
|
||||||
|
is_igst =True
|
||||||
|
|
||||||
|
|
||||||
rate_based_dict = self.items_based_on_tax_rate.setdefault(parent, {})\
|
rate_based_dict = self.items_based_on_tax_rate.setdefault(parent, {})\
|
||||||
.setdefault(tax_rate, [])
|
.setdefault(tax_rate, {}).setdefault(is_igst, [])
|
||||||
|
print("rate_base_dict", rate_based_dict)
|
||||||
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)
|
||||||
|
rate_based_dict.append(tax_amt if is_igst else tax_amt / 2 )
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
if unidentified_gst_accounts:
|
if unidentified_gst_accounts:
|
||||||
|
Loading…
Reference in New Issue
Block a user