ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Uncheck Apply Tax Withholding Amount

bug
erpnext

#1

I am creating purchase invoice by unchecking Apply Tax Withholding Amount, (I don’t want to apply TDS).
It gets saved without applying, TDS but when I reload the page it automatically checks that Checkbox.

I commented these lines and it worked

Can anyone tell me whether it is bug or not, If not then why it is in onload


#2

I found this in purchase_invoice.py


#3

It is probably because you have the supplier set up with TDS in the master.

If your invoice is submitted it probably would not check the box again. If your requirement is to not have it being checked again by default in draft mode, probably you should try to use frm.doc.__islocal to check if the document is already saved or no.


#4

yes, I do have the TDS setup in supplier but while creating purchase invoice I explicitly uncheck that checkbox and save the doc. But when I reload the doc, this onload again makes it checked.

It is checking the box in submitted invoice too.

I fixed it (or we can say made a patch on it) by resetting the check box value again from DB value.

function resetTDS(frm) {
  // This is a patch for onload function of purchase_invoice.js, 
  // which forcefully sets apply_tds even if I don't want to apply
  frappe.db.get_value('Purchase Invoice', frm.doc.name, 'apply_tds', function (response) {
    if (response) {
      frm.doc.apply_tds = response.apply_tds
      frm.set_df_property('apply_tds', response.apply_tds);
    }
  })
}

#5

Any updates there?
Am I doing something wrong?