fix: Fixes in TDS payable monthly report
This commit is contained in:
parent
86ef932979
commit
2ff6b3560e
@ -23,7 +23,7 @@ def validate_filters(filters):
|
|||||||
def get_result(filters, tds_docs, tds_accounts, tax_category_map):
|
def get_result(filters, tds_docs, tds_accounts, tax_category_map):
|
||||||
supplier_map = get_supplier_pan_map()
|
supplier_map = get_supplier_pan_map()
|
||||||
tax_rate_map = get_tax_rate_map(filters)
|
tax_rate_map = get_tax_rate_map(filters)
|
||||||
gle_map = get_gle_map(filters, tds_docs)
|
gle_map = get_gle_map(tds_docs)
|
||||||
|
|
||||||
out = []
|
out = []
|
||||||
for name, details in gle_map.items():
|
for name, details in gle_map.items():
|
||||||
@ -78,7 +78,7 @@ def get_supplier_pan_map():
|
|||||||
|
|
||||||
return supplier_map
|
return supplier_map
|
||||||
|
|
||||||
def get_gle_map(filters, documents):
|
def get_gle_map(documents):
|
||||||
# create gle_map of the form
|
# create gle_map of the form
|
||||||
# {"purchase_invoice": list of dict of all gle created for this invoice}
|
# {"purchase_invoice": list of dict of all gle created for this invoice}
|
||||||
gle_map = {}
|
gle_map = {}
|
||||||
@ -86,7 +86,7 @@ def get_gle_map(filters, documents):
|
|||||||
gle = frappe.db.get_all('GL Entry',
|
gle = frappe.db.get_all('GL Entry',
|
||||||
{
|
{
|
||||||
"voucher_no": ["in", documents],
|
"voucher_no": ["in", documents],
|
||||||
"credit": (">", 0)
|
"is_cancelled": 0
|
||||||
},
|
},
|
||||||
["credit", "debit", "account", "voucher_no", "posting_date", "voucher_type", "against", "party"],
|
["credit", "debit", "account", "voucher_no", "posting_date", "voucher_type", "against", "party"],
|
||||||
)
|
)
|
||||||
@ -184,21 +184,25 @@ def get_tds_docs(filters):
|
|||||||
payment_entries = []
|
payment_entries = []
|
||||||
journal_entries = []
|
journal_entries = []
|
||||||
tax_category_map = {}
|
tax_category_map = {}
|
||||||
|
or_filters={}
|
||||||
|
|
||||||
tds_accounts = frappe.get_all("Tax Withholding Account", {'company': filters.get('company')},
|
tds_accounts = frappe.get_all("Tax Withholding Account", {'company': filters.get('company')},
|
||||||
pluck="account")
|
pluck="account")
|
||||||
|
|
||||||
query_filters = {
|
query_filters = {
|
||||||
"credit": ('>', 0),
|
|
||||||
"account": ("in", tds_accounts),
|
"account": ("in", tds_accounts),
|
||||||
"posting_date": ("between", [filters.get("from_date"), filters.get("to_date")]),
|
"posting_date": ("between", [filters.get("from_date"), filters.get("to_date")]),
|
||||||
"is_cancelled": 0
|
"is_cancelled": 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if filters.get('supplier'):
|
if filters.get("supplier"):
|
||||||
query_filters.update({'against': filters.get('supplier')})
|
del query_filters["account"]
|
||||||
|
or_filters = {
|
||||||
|
"against": filters.get('supplier'),
|
||||||
|
"party": filters.get('supplier')
|
||||||
|
}
|
||||||
|
|
||||||
tds_docs = frappe.get_all("GL Entry", query_filters, ["voucher_no", "voucher_type", "against", "party"])
|
tds_docs = frappe.get_all("GL Entry", filters=query_filters, or_filters=or_filters, fields=["voucher_no", "voucher_type", "against", "party"])
|
||||||
|
|
||||||
for d in tds_docs:
|
for d in tds_docs:
|
||||||
if d.voucher_type == "Purchase Invoice":
|
if d.voucher_type == "Purchase Invoice":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user