@@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json | |||||
from .exceptions import * | from .exceptions import * | ||||
from .utils.jinja import get_jenv, get_template, render_template, get_email_from_template | from .utils.jinja import get_jenv, get_template, render_template, get_email_from_template | ||||
__version__ = '8.6.7' | |||||
__version__ = '8.6.8' | |||||
__title__ = "Frappe Framework" | __title__ = "Frappe Framework" | ||||
local = Local() | local = Local() | ||||
@@ -10,11 +10,23 @@ QUnit.test("test customize form", function(assert) { | |||||
() => frappe.timeout(2), | () => frappe.timeout(2), | ||||
() => cur_frm.set_value('doc_type', 'ToDo'), | () => cur_frm.set_value('doc_type', 'ToDo'), | ||||
() => frappe.timeout(2), | () => frappe.timeout(2), | ||||
() => assert.equal(cur_frm.doc.fields[1].fieldname, 'status', "Status Field"), | |||||
() => { | |||||
// find the status column as there may be other custom fields like | |||||
// kanban etc. | |||||
frappe.row_idx = 0; | |||||
cur_frm.doc.fields.every((d, i) => { | |||||
if(d.fieldname==='status') { | |||||
frappe.row_idx = i; | |||||
return false; | |||||
} else { | |||||
return true; | |||||
} | |||||
}); | |||||
assert.equal(cur_frm.doc.fields[frappe.row_idx].fieldname, 'status', | |||||
'check if selected field is "status"'); | |||||
}, | |||||
// open "status" row | // open "status" row | ||||
() => cur_frm.fields_dict.fields.grid.grid_rows[1].toggle_view(), | |||||
() => cur_frm.fields_dict.fields.grid.grid_rows[frappe.row_idx].toggle_view(), | |||||
() => frappe.timeout(0.5), | () => frappe.timeout(0.5), | ||||
// try deleting it | // try deleting it | ||||
@@ -25,7 +37,8 @@ QUnit.test("test customize form", function(assert) { | |||||
() => frappe.timeout(0.5), | () => frappe.timeout(0.5), | ||||
// status still exists | // status still exists | ||||
() => assert.equal(cur_frm.doc.fields[1].fieldname, 'status', "Status Field Still Exists"), | |||||
() => assert.equal(cur_frm.doc.fields[frappe.row_idx].fieldname, 'status', | |||||
'check if selected field is still "status"'), | |||||
() => done() | () => done() | ||||
]); | ]); | ||||
}); | }); |
@@ -941,7 +941,7 @@ _f.Frm.prototype.validate_form_action = function(action, resolve) { | |||||
// Allow submit, write, cancel and create permissions for read only documents that are assigned by | // Allow submit, write, cancel and create permissions for read only documents that are assigned by | ||||
// workflows if the user already have those permissions. This is to allow for users to | // workflows if the user already have those permissions. This is to allow for users to | ||||
// continue through the workflow states and to allow execution of functions like Duplicate. | // continue through the workflow states and to allow execution of functions like Duplicate. | ||||
if (frappe.workflow.is_read_only(this.doctype, this.docname) && (perms["write"] || | |||||
if (!frappe.workflow.is_read_only(this.doctype, this.docname) && (perms["write"] || | |||||
perms["create"] || perms["submit"] || perms["cancel"])) { | perms["create"] || perms["submit"] || perms["cancel"])) { | ||||
var allowed_for_workflow = true; | var allowed_for_workflow = true; | ||||
} | } | ||||