"Can refer row only if the charge type is 'On Previous Row Amount' or 'Previous Row Total'"

Hi everyone,

i am running into an issue and and trying to deal with it.
when i tick off the “Apply Withholding Taxes” the template does show up in the purchase taxes and charges table, also including the “Purchase Taxes And Charges Template”. As shown in the picture below

but when i save the Purchase invoice, it gives me this error.

can refer row

i want to set the type to “On Previous Row Total” but cant seem to do so because of the error showing up, even though i have referred the row number in the row.

another thing that i would like to mention is that when i tick off the “Apply Tax Withholding”, it’s showing up the type of “On Net Actual” which i change it to “On Previous Row Total”

if there’s a workaround this error then please let me know.

Regards,
Muhammad Shouib Saeed

the only workaround i have found is to use this script.

Server Script for Purchase Invoice - Before Save

This script will iterate through the “Purchase Taxes and Charges” table

and update the “charge_type” to “Actual” for any row that has

“On Previous Row Total” as its original value.

for tax in doc.taxes:
# Check if charge_type is set to “On Previous Row Total”
if tax.charge_type == “On Previous Row Total”:
# Change the charge type to “Actual”
tax.charge_type = “Actual”

it works for me in such a way that the purchase taxes and charges template is already set with type as “On Previous Row Total”, the server script runs to change that type to “Actual”, and the amount to be deducted or add remains the same.