Skip to content

Commit

Permalink
fix: category required for gstin level matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninad1306 committed Jan 21, 2025
1 parent 432cdee commit 4eaeb7f
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@

class IMSReconciler(Reconciler):
CATEGORIES = (
{"doc_type": ["Invoice", "Debit Note"]},
{"doc_type": ["Credit Note"]},
{"doc_type": "Invoice", "category": "B2B"},
{"doc_type": "Debit Note", "category": "CDNR"},
{"doc_type": "Credit Note", "category": "CDNR"},
)

def reconcile(self, filters):
"""
Reconcile purchases and inward supplies.
"""
for row in self.CATEGORIES:
filters.update(row)
filters["doc_type"], self.category = row.values()

purchases = PurchaseInvoice().get_unmatched(filters)
inward_supplies = InwardSupply().get_unmatched(filters)
Expand Down Expand Up @@ -67,7 +68,7 @@ def get_unmatched(self, filters):
query = self.get_query(filters.company_gstin)
data = (
query.where(IfNull(self.IMS.match_status, "") == "")
.where(self.IMS.doc_type.isin(filters.doc_type))
.where(self.IMS.doc_type == filters.doc_type)
.run(as_dict=True)
)

Expand Down Expand Up @@ -152,7 +153,7 @@ def get_unmatched(self, filters):
"Tax Collector",
"Input Service Distributor",
)
is_return = 1 if "Credit Note" in filters.doc_type else 0
is_return = 1 if filters.doc_type == "Credit Note" else 0

data = (
self.get_query(filters=filters)
Expand Down

0 comments on commit 4eaeb7f

Please sign in to comment.