fix: certificate button only on paid Purchase Invoices
The certificate is issued when the tax is withheld, i.e. on payment; show the button once the submitted invoice's status is Paid.
This commit is contained in:
@@ -22,7 +22,7 @@ without a Thai system font. Switch a user or the print language to `th` to use i
|
||||
|
||||
### Withholding tax certificate
|
||||
|
||||
A Purchase Invoice with *Apply Tax Withholding Amount* gets a **Withholding Tax Certificate**
|
||||
A paid Purchase Invoice with *Apply Tax Withholding Amount* gets a **Withholding Tax Certificate**
|
||||
button that downloads the Revenue Department's Sec. 50 bis form (หนังสือรับรองการหักภาษี ณ ที่จ่าย,
|
||||
two copies) as a PDF: the *Withholding Tax Certificate* print format lays the invoice's data
|
||||
over the official form (`public/images`). The row the payment is reported on comes from
|
||||
|
||||
@@ -1,23 +1,10 @@
|
||||
frappe.ui.form.on("Purchase Invoice", {
|
||||
refresh(frm) {
|
||||
frm.events.toggle_withholding_certificate(frm);
|
||||
},
|
||||
|
||||
apply_tds(frm) {
|
||||
frm.events.toggle_withholding_certificate(frm);
|
||||
},
|
||||
|
||||
toggle_withholding_certificate(frm) {
|
||||
const label = __("Withholding Tax Certificate");
|
||||
frm.remove_custom_button(label);
|
||||
if (!frm.doc.apply_tds || frm.is_new() || frm.doc.docstatus === 2) return;
|
||||
// The certificate is issued once the tax has been withheld, i.e. on payment.
|
||||
if (!frm.doc.apply_tds || frm.doc.docstatus !== 1 || frm.doc.status !== "Paid") return;
|
||||
// The Withholding Tax Certificate print format renders the Revenue Department's
|
||||
// Sec. 50 bis form (fixtures/print_format.json) as a PDF.
|
||||
frm.add_custom_button(label, () => {
|
||||
if (frm.is_dirty()) {
|
||||
frappe.msgprint(__("Please save the document before generating the certificate."));
|
||||
return;
|
||||
}
|
||||
frm.add_custom_button(__("Withholding Tax Certificate"), () => {
|
||||
const params = new URLSearchParams({
|
||||
doctype: frm.doctype,
|
||||
name: frm.docname,
|
||||
|
||||
@@ -61,7 +61,6 @@ Withholding Tax Receivable,ภาษีถูกหัก ณ ที่จ่า
|
||||
Output VAT,ภาษีขาย
|
||||
Input VAT,ภาษีซื้อ
|
||||
Withholding Tax Certificate,หนังสือรับรองการหักภาษี ณ ที่จ่าย
|
||||
Please save the document before generating the certificate.,กรุณาบันทึกเอกสารก่อนออกหนังสือรับรองการหักภาษี ณ ที่จ่าย
|
||||
Type of Income Paid,ประเภทเงินได้พึงประเมินที่จ่าย
|
||||
Salary and Wages - Sec. 40(1),เงินเดือน ค่าจ้าง ฯลฯ ตามมาตรา 40(1)
|
||||
Fees and Commissions - Sec. 40(2),ค่าธรรมเนียม ค่านายหน้า ฯลฯ ตามมาตรา 40(2)
|
||||
|
||||
|
Reference in New Issue
Block a user