fix: Hardcode fiscal year and posting date

This commit is contained in:
Deepesh Garg 2021-09-05 17:56:12 +05:30
parent 092d41ecda
commit 51d9572fe7
2 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@ def get_data():
}, },
{ {
'label': _('References'), 'label': _('References'),
'items': ['Period Closing Voucher', 'Tax Withholding Category'] 'items': ['Period Closing Voucher']
}, },
{ {
'label': _('Target Details'), 'label': _('Target Details'),

View File

@ -1151,10 +1151,11 @@ class TestPurchaseInvoice(unittest.TestCase):
tax_withholding_category = 'TDS - 194 - Dividends - Individual') tax_withholding_category = 'TDS - 194 - Dividends - Individual')
# Update tax withholding category with current fiscal year and rate details # Update tax withholding category with current fiscal year and rate details
update_tax_witholding_category('_Test Company', 'TDS Payable - _TC', nowdate()) update_tax_witholding_category('_Test Company', 'TDS Payable - _TC')
# Create Purchase Order with TDS applied # Create Purchase Order with TDS applied
po = create_purchase_order(do_not_save=1, supplier=supplier.name, rate=3000, item='_Test Non Stock Item') po = create_purchase_order(do_not_save=1, supplier=supplier.name, rate=3000, item='_Test Non Stock Item',
posting_date='2021-09-15')
po.apply_tds = 1 po.apply_tds = 1
po.tax_withholding_category = 'TDS - 194 - Dividends - Individual' po.tax_withholding_category = 'TDS - 194 - Dividends - Individual'
po.save() po.save()
@ -1226,11 +1227,10 @@ def check_gl_entries(doc, voucher_no, expected_gle, posting_date):
doc.assertEqual(expected_gle[i][2], gle.credit) doc.assertEqual(expected_gle[i][2], gle.credit)
doc.assertEqual(getdate(expected_gle[i][3]), gle.posting_date) doc.assertEqual(getdate(expected_gle[i][3]), gle.posting_date)
def update_tax_witholding_category(company, account, date): def update_tax_witholding_category(company, account):
from erpnext.accounts.utils import get_fiscal_year from erpnext.accounts.utils import get_fiscal_year
fiscal_year = get_fiscal_year(date=date, company=company) fiscal_year = get_fiscal_year(fiscal_year='_Test Fiscal Year 2021')
print(fiscal_year[0], fiscal_year[1], fiscal_year[2], "$#$#$#")
if not frappe.db.get_value('Tax Withholding Rate', if not frappe.db.get_value('Tax Withholding Rate',
{'parent': 'TDS - 194 - Dividends - Individual', 'from_date': ('>=', fiscal_year[1]), {'parent': 'TDS - 194 - Dividends - Individual', 'from_date': ('>=', fiscal_year[1]),