fix: validate voucher type while checking journal entry against payroll entry
This commit is contained in:
@@ -722,12 +722,21 @@ def get_month_details(year, month):
|
||||
|
||||
def get_payroll_entry_bank_entries(payroll_entry_name):
|
||||
journal_entries = frappe.db.sql(
|
||||
"select name from `tabJournal Entry Account` "
|
||||
'where reference_type="Payroll Entry" '
|
||||
"and reference_name=%s and docstatus=1",
|
||||
"""
|
||||
select
|
||||
je.name
|
||||
from
|
||||
`tabJournal Entry` je,
|
||||
`tabJournal Entry Account` jea
|
||||
where
|
||||
je.name = jea.parent
|
||||
and je.voucher_type = 'Bank Entry'
|
||||
and jea.reference_type = 'Payroll Entry'
|
||||
and jea.reference_name = %s
|
||||
""",
|
||||
payroll_entry_name,
|
||||
as_dict=1,
|
||||
)
|
||||
as_dict=True,
|
||||
) # nosemgrep
|
||||
|
||||
return journal_entries
|
||||
|
||||
|
||||
@@ -133,9 +133,17 @@ class TestPayrollEntry(FrappeTestCase):
|
||||
|
||||
payment_entry = frappe.db.sql(
|
||||
"""
|
||||
Select ifnull(sum(je.total_debit),0) as total_debit, ifnull(sum(je.total_credit),0) as total_credit from `tabJournal Entry` je, `tabJournal Entry Account` jea
|
||||
Where je.name = jea.parent
|
||||
And jea.reference_name = %s
|
||||
select
|
||||
ifnull(sum(je.total_debit),0) as total_debit,
|
||||
ifnull(sum(je.total_credit),0) as total_credit
|
||||
from
|
||||
`tabJournal Entry` je,
|
||||
`tabJournal Entry Account` jea
|
||||
Where
|
||||
je.name = jea.parent
|
||||
and je.voucher_type = 'Bank Entry'
|
||||
and jea.reference_type = 'Payroll Entry'
|
||||
and jea.reference_name = %s
|
||||
""",
|
||||
(payroll_entry.name),
|
||||
as_dict=1,
|
||||
|
||||
Reference in New Issue
Block a user