fix: tds test case
This commit is contained in:
parent
c1187bc1d5
commit
f0b1670abc
@ -7,6 +7,7 @@ import frappe
|
|||||||
import unittest
|
import unittest
|
||||||
from frappe.utils import today
|
from frappe.utils import today
|
||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import get_fiscal_year
|
||||||
|
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
|
||||||
|
|
||||||
test_dependencies = ["Supplier Group"]
|
test_dependencies = ["Supplier Group"]
|
||||||
|
|
||||||
@ -103,17 +104,20 @@ class TestTaxWithholdingCategory(unittest.TestCase):
|
|||||||
|
|
||||||
def test_single_threshold_tds_with_previous_vouchers_and_no_tds(self):
|
def test_single_threshold_tds_with_previous_vouchers_and_no_tds(self):
|
||||||
invoices = []
|
invoices = []
|
||||||
frappe.db.set_value("Supplier", "Test TDS Supplier2", "tax_withholding_category", "Single Threshold TDS")
|
doc = create_supplier(supplier_name = "Test TDS Supplier ABC",
|
||||||
pi = create_purchase_invoice(supplier="Test TDS Supplier2")
|
tax_withholding_category="Single Threshold TDS")
|
||||||
|
supplier = doc.name
|
||||||
|
|
||||||
|
pi = create_purchase_invoice(supplier=supplier)
|
||||||
pi.submit()
|
pi.submit()
|
||||||
invoices.append(pi)
|
invoices.append(pi)
|
||||||
|
|
||||||
# TDS not applied
|
# TDS not applied
|
||||||
pi = create_purchase_invoice(supplier="Test TDS Supplier2", do_not_apply_tds=True)
|
pi = create_purchase_invoice(supplier=supplier, do_not_apply_tds=True)
|
||||||
pi.submit()
|
pi.submit()
|
||||||
invoices.append(pi)
|
invoices.append(pi)
|
||||||
|
|
||||||
pi = create_purchase_invoice(supplier="Test TDS Supplier2")
|
pi = create_purchase_invoice(supplier=supplier)
|
||||||
pi.submit()
|
pi.submit()
|
||||||
invoices.append(pi)
|
invoices.append(pi)
|
||||||
|
|
||||||
|
@ -120,3 +120,20 @@ class TestSupplier(unittest.TestCase):
|
|||||||
|
|
||||||
# Rollback
|
# Rollback
|
||||||
address.delete()
|
address.delete()
|
||||||
|
|
||||||
|
def create_supplier(**args):
|
||||||
|
args = frappe._dict(args)
|
||||||
|
|
||||||
|
try:
|
||||||
|
doc = frappe.get_doc({
|
||||||
|
"doctype": "Supplier",
|
||||||
|
"supplier_name": args.supplier_name,
|
||||||
|
"supplier_group": args.supplier_group or "Services",
|
||||||
|
"supplier_type": args.supplier_type or "Company",
|
||||||
|
"tax_withholding_category": args.tax_withholding_category
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
return doc
|
||||||
|
|
||||||
|
except frappe.DuplicateEntryError:
|
||||||
|
return frappe.get_doc("Supplier", args.supplier_name)
|
Loading…
Reference in New Issue
Block a user