diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py index d75101d0e13..fc1916b5bcd 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py @@ -186,9 +186,14 @@ class JournalVoucher(AccountsController): def set_print_format_fields(self): for d in self.get('entries'): - account_type, master_type = frappe.db.get_value("Account", d.account, + result = frappe.db.get_value("Account", d.account, ["account_type", "master_type"]) + if not result: + continue + + account_type, master_type = result + if master_type in ['Supplier', 'Customer']: if not self.pay_to_recd_from: self.pay_to_recd_from = frappe.db.get_value(master_type,