Fixes in action, not defined if called from outside document class
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index aba7a88..df5370a 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -12,7 +12,7 @@
 
 class AccountsController(TransactionBase):
 	def validate(self):
-		if self._action != "update_after_submit":
+		if self.get("_action") and self._action != "update_after_submit":
 			self.set_missing_values(for_validate=True)
 		self.validate_date_with_fiscal_year()
 		if self.meta.get_field("currency"):