diff --git a/frappe/model/document.py b/frappe/model/document.py index e000923a10..8545161917 100644 --- a/frappe/model/document.py +++ b/frappe/model/document.py @@ -1536,11 +1536,16 @@ class Document(BaseDocument): primary_action=primary_action, ) + enqueue_after_commit = kwargs.pop("enqueue_after_commit", None) + if enqueue_after_commit is None: + enqueue_after_commit = True + return enqueue( "frappe.model.document.execute_action", __doctype=self.doctype, __name=self.name, __action=action, + enqueue_after_commit=enqueue_after_commit, **kwargs, )