-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: get and update filing preference
- Loading branch information
Showing
6 changed files
with
106 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
india_compliance/patches/v15/update_return_logs_with_filing_preference.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import frappe | ||
|
||
from india_compliance.gst_india.utils.gstin_info import fetch_filing_preference | ||
|
||
|
||
def patch_filing_preference(gstin): | ||
logs = frappe.get_all( | ||
"GST Return Log", | ||
filters={ | ||
"filing_preference": ["is", "not set"], | ||
"gstin": gstin, | ||
"return_perid": ["!=", "ALL"], | ||
}, | ||
fields=["name", "return_period", "gstin"], | ||
) | ||
|
||
if not logs: | ||
return | ||
|
||
for log in logs: | ||
preference = fetch_filing_preference(log.gstin, log.return_period) | ||
frappe.db.set_value("GST Return Log", log.name, "filing_preference", preference) |