Skip to content

Commit

Permalink
fix: enqueue_after_commit wherever it makes sense
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Jun 7, 2023
1 parent 9e650a0 commit d791e4f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ def after_insert(self):
if frappe.flags.in_test:
make_dimension_in_accounting_doctypes(doc=self)
else:
frappe.enqueue(make_dimension_in_accounting_doctypes, doc=self, queue="long")
frappe.enqueue(
make_dimension_in_accounting_doctypes, doc=self, queue="long", enqueue_after_commit=True
)

def on_trash(self):
if frappe.flags.in_test:
delete_accounting_dimension(doc=self)
else:
frappe.enqueue(delete_accounting_dimension, doc=self, queue="long")
frappe.enqueue(delete_accounting_dimension, doc=self, queue="long", enqueue_after_commit=True)

def set_fieldname_and_label(self):
if not self.label:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def on_cancel(self):
voucher_type="Period Closing Voucher",
voucher_no=self.name,
queue="long",
enqueue_after_commit=True,
)
frappe.msgprint(
_("The GL Entries will be cancelled in the background, it can take a few minutes."), alert=True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ def on_submit(self):
boms=boms,
timeout=40000,
now=frappe.flags.in_test,
enqueue_after_commit=True,
)
else:
frappe.enqueue(
method="erpnext.manufacturing.doctype.bom_update_log.bom_update_log.process_boms_cost_level_wise",
update_doc=self,
now=frappe.flags.in_test,
enqueue_after_commit=True,
)


Expand Down
1 change: 1 addition & 0 deletions erpnext/stock/doctype/item/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ def update_variants(self):
template=self,
now=frappe.flags.in_test,
timeout=600,
enqueue_after_commit=True,
)

def validate_has_variants(self):
Expand Down
1 change: 1 addition & 0 deletions erpnext/stock/doctype/stock_settings/stock_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def validate_clean_description_html(self):
frappe.enqueue(
"erpnext.stock.doctype.stock_settings.stock_settings.clean_all_descriptions",
now=frappe.flags.in_test,
enqueue_after_commit=True,
)

def validate_pending_reposts(self):
Expand Down

0 comments on commit d791e4f

Please sign in to comment.