mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
Merge pull request #24579 from marination/acc-dimension-update-hotfix
fix: Avoid changing Ref. Doctype in Accounting Dimension after creation
This commit is contained in:
@@ -41,6 +41,8 @@ frappe.ui.form.on('Accounting Dimension', {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frm.toggle_enable('document_type', frm.doc.__islocal);
|
||||||
},
|
},
|
||||||
|
|
||||||
document_type: function(frm) {
|
document_type: function(frm) {
|
||||||
|
|||||||
@@ -29,6 +29,16 @@ class AccountingDimension(Document):
|
|||||||
if exists and self.is_new():
|
if exists and self.is_new():
|
||||||
frappe.throw("Document Type already used as a dimension")
|
frappe.throw("Document Type already used as a dimension")
|
||||||
|
|
||||||
|
if not self.is_new():
|
||||||
|
self.validate_document_type_change()
|
||||||
|
|
||||||
|
def validate_document_type_change(self):
|
||||||
|
doctype_before_save = frappe.db.get_value("Accounting Dimension", self.name, "document_type")
|
||||||
|
if doctype_before_save != self.document_type:
|
||||||
|
message = _("Cannot change Reference Document Type.")
|
||||||
|
message += _("Please create a new Accounting Dimension if required.")
|
||||||
|
frappe.throw(message)
|
||||||
|
|
||||||
def after_insert(self):
|
def after_insert(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)
|
||||||
|
|||||||
Reference in New Issue
Block a user