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"):
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 4b147cc..c1ddf63 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -134,7 +134,7 @@
 
 
 	def update_current_stock(self):
-		if self._action != "update_after_submit":
+		if self.get("_action") and self._action != "update_after_submit":
 			for d in self.get('delivery_note_details'):
 				d.actual_qty = frappe.db.get_value("Bin", {"item_code": d.item_code,
 					"warehouse": d.warehouse}, "actual_qty")
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index 44c1a00..f04625b 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -62,7 +62,7 @@
 def make_packing_list(obj, item_table_fieldname):
 	"""make packing list for sales bom item"""
 
-	if obj._action == "update_after_submit": return
+	if obj.get("_action") and obj._action == "update_after_submit": return
 
 	packing_list_idx = 0
 	parent_items = []