Skip to content

Commit

Permalink
fix: Hardcode fiscal year and posting date
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 committed Sep 14, 2021
1 parent 0bb16b6 commit f101241
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_data():
},
{
'label': _('References'),
'items': ['Period Closing Voucher', 'Tax Withholding Category']
'items': ['Period Closing Voucher']
},
{
'label': _('Target Details'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1128,10 +1128,11 @@ def test_purchase_invoice_advance_taxes(self):
tax_withholding_category = 'TDS - 194 - Dividends - Individual')

# 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
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.tax_withholding_category = 'TDS - 194 - Dividends - Individual'
po.save()
Expand Down Expand Up @@ -1203,11 +1204,10 @@ def check_gl_entries(doc, voucher_no, expected_gle, posting_date):
doc.assertEqual(expected_gle[i][2], gle.credit)
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

fiscal_year = get_fiscal_year(date=date, company=company)
print(fiscal_year[0], fiscal_year[1], fiscal_year[2], "$#$#$#")
fiscal_year = get_fiscal_year(fiscal_year='_Test Fiscal Year 2021')

if not frappe.db.get_value('Tax Withholding Rate',
{'parent': 'TDS - 194 - Dividends - Individual', 'from_date': ('>=', fiscal_year[1]),
Expand Down

0 comments on commit f101241

Please sign in to comment.