refactor: tax rule validity query (#30934)
This commit is contained in:
parent
e5ebbf4799
commit
05dd1d6d15
@ -163,17 +163,15 @@ def get_party_details(party, party_type, args=None):
|
|||||||
def get_tax_template(posting_date, args):
|
def get_tax_template(posting_date, args):
|
||||||
"""Get matching tax rule"""
|
"""Get matching tax rule"""
|
||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
from_date = to_date = posting_date
|
conditions = []
|
||||||
if not posting_date:
|
|
||||||
from_date = "1900-01-01"
|
|
||||||
to_date = "4000-01-01"
|
|
||||||
|
|
||||||
conditions = [
|
if posting_date:
|
||||||
"""(from_date is null or from_date <= '{0}')
|
conditions.append(
|
||||||
and (to_date is null or to_date >= '{1}')""".format(
|
f"""(from_date is null or from_date <= '{posting_date}')
|
||||||
from_date, to_date
|
and (to_date is null or to_date >= '{posting_date}')"""
|
||||||
)
|
)
|
||||||
]
|
else:
|
||||||
|
conditions.append("(from_date is null) and (to_date is null)")
|
||||||
|
|
||||||
conditions.append(
|
conditions.append(
|
||||||
"ifnull(tax_category, '') = {0}".format(frappe.db.escape(cstr(args.get("tax_category"))))
|
"ifnull(tax_category, '') = {0}".format(frappe.db.escape(cstr(args.get("tax_category"))))
|
||||||
|
|||||||
@ -139,7 +139,7 @@ class TestShoppingCart(unittest.TestCase):
|
|||||||
tax_rule_master = set_taxes(
|
tax_rule_master = set_taxes(
|
||||||
quotation.party_name,
|
quotation.party_name,
|
||||||
"Customer",
|
"Customer",
|
||||||
quotation.transaction_date,
|
None,
|
||||||
quotation.company,
|
quotation.company,
|
||||||
customer_group=None,
|
customer_group=None,
|
||||||
supplier_group=None,
|
supplier_group=None,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user