test: fix for Item Tax Template v12

This commit is contained in:
Saif Ur Rehman 2019-01-11 03:53:43 +05:00
parent fc5c9b8ab8
commit 5085673030
2 changed files with 15 additions and 3 deletions

View File

@ -145,7 +145,7 @@ def get_tax_template(posting_date, args):
conditions = ["""(from_date is null or from_date <= '{0}')
and (to_date is null or to_date >= '{0}')""".format(posting_date)]
conditions.append("ifnull(tax_category, '') = '{0}'".format(frappe.db.escape(cstr(args.get("tax_category")))))
conditions.append("ifnull(tax_category, '') = {0}".format(frappe.db.escape(cstr(args.get("tax_category")))))
if 'tax_category' in args.keys():
del args['tax_category']

View File

@ -27,6 +27,16 @@ class TestTaxes(unittest.TestCase):
'item_group_name': uuid4(),
'parent_item_group': 'All Item Groups',
}).insert()
self.item_tax_template = frappe.get_doc({
'doctype': 'Item Tax Template',
'title': uuid4(),
'taxes': [
{
'tax_type': self.account.name,
'tax_rate': 2,
}
]
}).insert()
self.item = frappe.get_doc({
'doctype': 'Item',
'item_code': uuid4(),
@ -34,8 +44,8 @@ class TestTaxes(unittest.TestCase):
'is_stock_item': 0,
'taxes': [
{
'tax_type': self.account.name,
'tax_rate': 2,
'item_tax_template': self.item_tax_template.name,
'tax_category': '',
}
],
}).insert()
@ -58,6 +68,7 @@ class TestTaxes(unittest.TestCase):
'doctype': dt,
'company': self.company.name,
'supplier': self.supplier.name,
'currency': "USD",
'schedule_date': frappe.utils.nowdate(),
'delivery_date': frappe.utils.nowdate(),
'customer': self.customer.name,
@ -90,5 +101,6 @@ class TestTaxes(unittest.TestCase):
doc.delete()
self.item.delete()
self.item_group.delete()
self.item_tax_template.delete()
self.account.delete()
self.company.delete()