Skip to content

Commit

Permalink
refactor: make Excluded doctype table read only
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Mar 16, 2024
1 parent b98a5e4 commit 7c4cff2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ frappe.ui.form.on("Transaction Deletion Record", {
});
}


frm.get_field('doctypes_to_be_ignored').grid.cannot_add_rows = true;

},

refresh: function(frm) {
if (frm.doc.docstatus==1 && ['Queued', 'Failed'].find(x => x == frm.doc.status)) {
let execute_btn = __("Start Deletion")

frm.add_custom_button(execute_btn, () => {
// Entry point for chain of events
frm.call({
method: 'delete_bins',
doc: frm.doc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"fieldname": "doctypes_to_be_ignored",
"fieldtype": "Table",
"label": "Excluded DocTypes",
"options": "Transaction Deletion Record Item"
"options": "Transaction Deletion Record Item",
"read_only": 1
},
{
"fieldname": "amended_from",
Expand Down Expand Up @@ -123,7 +124,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2024-02-04 10:55:09.430373",
"modified": "2024-02-04 15:28:29.532826",
"modified_by": "Administrator",
"module": "Setup",
"name": "Transaction Deletion Record",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def populate_doctypes_to_be_ignored_table(self):

@frappe.whitelist()
def delete_bins(self):
# This methid is the entry point for the chain of events that follow
if not self.delete_bin_data:
frappe.db.sql(
"""delete from `tabBin` where warehouse in
Expand Down

0 comments on commit 7c4cff2

Please sign in to comment.