mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-27 02:28:30 +00:00
fix: move make_dimension_in_accounting_doctypes from after_insert to on_update (backport #54172) (#54317)
* fix: move make_dimension_in_accounting_doctypes from after_insert to on_update
(cherry picked from commit ee067e6015)
# Conflicts:
# erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
* chore: resolve conflicts in accounting_dimension.py
---------
Co-authored-by: Shllokkk <shllokosan23@gmail.com>
This commit is contained in:
@@ -82,13 +82,15 @@ class AccountingDimension(Document):
|
|||||||
else:
|
else:
|
||||||
frappe.throw(_("Company {0} is added more than once").format(frappe.bold(default.company)))
|
frappe.throw(_("Company {0} is added more than once").format(frappe.bold(default.company)))
|
||||||
|
|
||||||
def after_insert(self):
|
def on_update(self):
|
||||||
if frappe.flags.in_test:
|
if frappe.flags.in_test:
|
||||||
make_dimension_in_accounting_doctypes(doc=self)
|
make_dimension_in_accounting_doctypes(doc=self)
|
||||||
else:
|
else:
|
||||||
frappe.enqueue(
|
frappe.enqueue(
|
||||||
make_dimension_in_accounting_doctypes, doc=self, queue="long", enqueue_after_commit=True
|
make_dimension_in_accounting_doctypes, doc=self, queue="long", enqueue_after_commit=True
|
||||||
)
|
)
|
||||||
|
frappe.flags.accounting_dimensions = None
|
||||||
|
frappe.flags.accounting_dimensions_details = None
|
||||||
|
|
||||||
def on_trash(self):
|
def on_trash(self):
|
||||||
if frappe.flags.in_test:
|
if frappe.flags.in_test:
|
||||||
@@ -103,10 +105,6 @@ class AccountingDimension(Document):
|
|||||||
if not self.fieldname:
|
if not self.fieldname:
|
||||||
self.fieldname = scrub(self.label)
|
self.fieldname = scrub(self.label)
|
||||||
|
|
||||||
def on_update(self):
|
|
||||||
frappe.flags.accounting_dimensions = None
|
|
||||||
frappe.flags.accounting_dimensions_details = None
|
|
||||||
|
|
||||||
|
|
||||||
def make_dimension_in_accounting_doctypes(doc, doclist=None):
|
def make_dimension_in_accounting_doctypes(doc, doclist=None):
|
||||||
if not doclist:
|
if not doclist:
|
||||||
|
|||||||
Reference in New Issue
Block a user