Tax to be Withheld at payment entry not purchase recording entry

Hi All,
Currently tax withholding is applied at time of recording a purchase invoice. However, in our tax system, tax is withheld at the time of payment.

Let me explain by an example:

  • Items purchased on credit from a vendor on 1st July with 30 days credit.
  • Purchase invoice recorded on 1st July. In current ERPNext system tax will be withheld on 1st July.
  • Payment made on 30th July. As per tax requirement, tax should be deducted on 30th July at time of payment and then deposited in government treasury within 7 days of deduction.

Is there any way to implement above in the ERPNext system so that tax withheld is deducted at time of payment and not at time of booking the purchase invoice?