Skip to content

Commit

Permalink
chore: variable names and minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
vorasmit committed Apr 23, 2024
1 parent 196921e commit 5044f88
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions india_compliance/gst_india/utils/gstr_2/gstr.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,22 @@ def get_supplier_transactions(self, category, supplier):
]

def get_transaction(self, category, supplier, invoice):
return frappe._dict(
transaction = frappe._dict(
company=self.company,
company_gstin=self.gstin,
# TODO: change classification to gstr_category
classification=category.value,
**self.get_supplier_details(supplier),
**self.get_invoice_details(invoice),
items=self.get_transaction_items(invoice),
unique_key=(supplier.ctin or "") + "-" + (invoice.inum or ""),
)

transaction["unique_key"] = (
f"{transaction.get('supplier_gstin', '')}-{transaction.get('bill_no', '')}"
)

return transaction

def get_supplier_details(self, supplier):
return {}

Expand Down
10 changes: 5 additions & 5 deletions india_compliance/gst_india/utils/gstr_2/gstr_2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ def get_existing_transaction(self):
).run(as_dict=True)

return {
transaction.get("supplier_gstin")
+ "-"
+ transaction.get("bill_no"): transaction.get("name")
f"{transaction.get('supplier_gstin', '')}-{transaction.get('bill_no', '')}": transaction.get(
"name"
)
for transaction in existing_transactions
}

def delete_missing_transactions(self):
if self.existing_transaction:
for value in self.existing_transaction.values():
frappe.delete_doc("GST Inward Supply", value)
for inward_supply_name in self.existing_transaction.values():
frappe.delete_doc("GST Inward Supply", inward_supply_name)

def get_supplier_details(self, supplier):
supplier_details = {
Expand Down

0 comments on commit 5044f88

Please sign in to comment.