fix: date condition in tax rule

This commit is contained in:
Ankush Menat 2022-04-24 20:14:01 +05:30
parent a90e7e32a4
commit 052171f51c

View File

@ -163,10 +163,15 @@ def get_party_details(party, party_type, args=None):
def get_tax_template(posting_date, args):
"""Get matching tax rule"""
args = frappe._dict(args)
from_date = to_date = posting_date
if not posting_date:
from_date = "1900-01-01"
to_date = "4000-01-01"
conditions = [
"""(from_date is null or from_date <= '{0}')
and (to_date is null or to_date >= '{0}')""".format(
posting_date
and (to_date is null or to_date >= '{1}')""".format(
from_date, to_date
)
]