fix: block cancellation of SL/GL entries (#30652)

Individual GL/SLEs aren't supposed to be cancelled by users.
This commit is contained in:
Ankush Menat 2022-04-08 18:05:04 +05:30 committed by GitHub
parent fcbd25f27a
commit af6b07f9b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions

View File

@ -3,6 +3,6 @@
frappe.ui.form.on('GL Entry', {
refresh: function(frm) {
frm.page.btn_secondary.hide()
}
});

View File

@ -269,6 +269,11 @@ class GLEntry(Document):
if not self.fiscal_year:
self.fiscal_year = get_fiscal_year(self.posting_date, company=self.company)[0]
def on_cancel(self):
msg = _("Individual GL Entry cannot be cancelled.")
msg += "<br>" + _("Please cancel related transaction.")
frappe.throw(msg)
def validate_balance_type(account, adv_adj=False):
if not adv_adj and account:

View File

@ -3,6 +3,6 @@
frappe.ui.form.on('Stock Ledger Entry', {
refresh: function(frm) {
frm.page.btn_secondary.hide()
}
});

View File

@ -209,6 +209,11 @@ class StockLedgerEntry(Document):
msg += "<br>" + "<br>".join(authorized_users)
frappe.throw(msg, BackDatedStockTransaction, title=_("Backdated Stock Entry"))
def on_cancel(self):
msg = _("Individual Stock Ledger Entry cannot be cancelled.")
msg += "<br>" + _("Please cancel related transaction.")
frappe.throw(msg)
def on_doctype_update():
if not frappe.db.has_index("tabStock Ledger Entry", "posting_sort_index"):