Skip to content

Commit

Permalink
fix: filter invalid invoice from excel
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Sep 27, 2024
1 parent 69a47cb commit 2f728a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 9 additions & 1 deletion india_compliance/gst_india/doctype/gstr_1_beta/gstr_1_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,15 @@ def process_doc_issue_data(self, data):
"""
Add draft count to cancelled count for DOC_ISSUE category
"""
for doc in data:
for doc in data.copy():
if doc.get(GSTR1_DataField.DOC_TYPE.value) in [
"Invalid Invoice Number (length greater than 16)",
"Excluded from Report (Same GSTIN Billing)",
"Excluded from Report (Is Opening Entry)",
]:
data.remove(doc)
continue

doc[GSTR1_DataField.CANCELLED_COUNT.value] += doc.get(
GSTR1_DataField.DRAFT_COUNT.value, 0
)
Expand Down
6 changes: 4 additions & 2 deletions india_compliance/gst_india/report/gstr_1/gstr_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,7 @@ def is_same_naming_series(self, name_1, name_2):

def seperate_data_by_nature_of_document(self, data, doctype):
nature_of_document = {
"Non GST Invoices": [],
"Invalid Invoice Number (length greater than 16)": [],
"Excluded from Report (Same GSTIN Billing)": [],
"Excluded from Report (Is Opening Entry)": [],
"Invoices for outward supply": [],
Expand All @@ -1605,7 +1605,9 @@ def seperate_data_by_nature_of_document(self, data, doctype):

for doc in data:
if len(doc.name) > 16 or not GST_INVOICE_NUMBER_FORMAT.match(doc.name):
nature_of_document["Non GST Invoices"].append(doc)
nature_of_document[
"Invalid Invoice Number (length greater than 16)"
].append(doc)
elif doc.is_opening == "Yes":
nature_of_document["Excluded from Report (Is Opening Entry)"].append(
doc
Expand Down

0 comments on commit 2f728a2

Please sign in to comment.