fix: Ignore for Purchase Invoices

(cherry picked from commit d3fd2fd2c535733939ed69439301033052f45712)
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 884deb3..22aa667 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -678,7 +678,7 @@
 				self.doc.precision("base_change_amount"))
 
 	def calculate_write_off_amount(self):
-		if self.doc.write_off_outstanding_amount_automatically:
+		if self.doc.get('write_off_outstanding_amount_automatically'):
 			self.doc.write_off_amount = flt(self.doc.outstanding_amount, self.doc.precision("write_off_amount"))
 			self.doc.base_write_off_amount = flt(self.doc.write_off_amount * self.doc.conversion_rate,
 				self.doc.precision("base_write_off_amount"))