Skip to content
6 changes: 4 additions & 2 deletions hrms/payroll/doctype/payroll_entry/payroll_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def has_bank_entries(self) -> dict[str, bool]:
.on(je.name == jea.parent)
.select(je.name)
.where(
(je.voucher_type == "Bank Entry")
((je.voucher_type == "Bank Entry") | (je.voucher_type == "Cash Entry"))
& (jea.reference_name == self.name)
& (jea.reference_type == "Payroll Entry")
)
Expand Down Expand Up @@ -1133,7 +1133,9 @@ def set_accounting_entries_for_bank_entry(
return self.make_journal_entry(
accounts,
currencies,
voucher_type="Bank Entry",
voucher_type="Cash Entry"
if frappe.get_cached_value("Account", self.payment_account, "account_type") == "Cash"
else "Bank Entry",
user_remark=_("Payment of {0} from {1} to {2}").format(
_(user_remark), self.start_date, self.end_date
),
Expand Down
4 changes: 2 additions & 2 deletions hrms/payroll/doctype/payroll_entry/test_payroll_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_multi_currency_payroll_entry(self):
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 (je.voucher_type = 'Bank Entry' or je.voucher_type = 'Cash Entry')
and jea.reference_name = %s
""",
payroll_entry.name,
Expand Down Expand Up @@ -820,7 +820,7 @@ def run_test_for_loan_repayment_from_salary(self):
SELECT je.total_debit, je.total_credit
FROM `tabJournal Entry` je
INNER JOIN `tabJournal Entry Account` jea ON je.name = jea.parent
WHERE je.voucher_type = 'Bank Entry' AND jea.reference_type = 'Payroll Entry' AND jea.reference_name = %s
WHERE (je.voucher_type = 'Bank Entry' or je.voucher_type = 'Cash Entry') AND jea.reference_type = 'Payroll Entry' AND jea.reference_name = %s
LIMIT 1
""",
payroll_entry.name,
Expand Down
Loading