From d0e95a6f24e12508a23abdcce60510afb8ac5456 Mon Sep 17 00:00:00 2001 From: Kitti U Date: Thu, 8 Feb 2024 15:55:29 +0700 Subject: [PATCH] FIX: error when create WHT for Employee --- thai_tax/public/js/payment_entry.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/thai_tax/public/js/payment_entry.js b/thai_tax/public/js/payment_entry.js index e429e8a..e6f5f1e 100644 --- a/thai_tax/public/js/payment_entry.js +++ b/thai_tax/public/js/payment_entry.js @@ -16,11 +16,14 @@ frappe.ui.form.on("Payment Entry", { frm.doc.deductions.length > 0 ) { frm.add_custom_button(__("Create Withholding Tax Cert"), async function () { - let income_tax_form = ( - await frappe.db.get_value( - frm.doc.party_type, frm.doc.party, "custom_default_income_tax_form" - ) - ).message.custom_default_income_tax_form; + let income_tax_form = ""; + if (frm.doc.party_type == "Supplier") { + income_tax_form = ( + await frappe.db.get_value( + frm.doc.party_type, frm.doc.party, "custom_default_income_tax_form" + ) + ).message.custom_default_income_tax_form; + } const fields = [ { fieldtype: "Link",