fix: Incorrect indentation
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index c526029..56e03e1 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -150,12 +150,6 @@
 			if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)):
 				self.set_advances()
 
-		if self.doctype == 'Purchase Invoice':
-			self.calculate_paid_amount()
-			# apply tax withholding only if checked and applicable
-			self.set_tax_withholding()
-
-
 			self.set_advance_gain_or_loss()
 
 			if self.is_return:
@@ -165,6 +159,11 @@
 
 			self.set_inter_company_account()
 
+		if self.doctype == 'Purchase Invoice':
+			self.calculate_paid_amount()
+			# apply tax withholding only if checked and applicable
+			self.set_tax_withholding()
+
 		validate_regional(self)
 
 		if self.doctype != 'Material Request':