added explain to get_status in field for debugging
This commit is contained in:
parent
ff65cd6dcc
commit
ea945f4e7d
4 changed files with 23 additions and 6 deletions
|
|
@ -10,7 +10,7 @@ wn.pages['data-import-tool'].onload = function(wrapper) {
|
|||
<p class="float-column">\
|
||||
<select style="width: 200px" name="dit-doctype">\
|
||||
</select><br><br>\
|
||||
<input type="checkbox" name="dit-with-data">\
|
||||
<input type="checkbox" name="dit-with-data" style="margin-top: -3px">\
|
||||
<span> Download with data</span>\
|
||||
</p>\
|
||||
<p class="float-column" id="dit-download"></p>\
|
||||
|
|
@ -141,12 +141,14 @@ wn.pages['data-import-tool'].onload = function(wrapper) {
|
|||
});
|
||||
|
||||
// add overwrite option
|
||||
$('<input type="checkbox" name="overwrite"><span> Overwrite</span>\
|
||||
$('<input type="checkbox" name="overwrite" style="margin-top: -3px">\
|
||||
<span> Overwrite</span>\
|
||||
<p class="help">If you are uploading a child table (for example Item Price), the all the entries of that table will be deleted (for that parent record) and new entries will be made.</p><br>')
|
||||
.insertBefore('#dit-upload-area form input[type="submit"]')
|
||||
|
||||
// add ignore option
|
||||
$('<input type="checkbox" name="ignore_encoding_errors"><span> Ignore Encoding Errors</span><br><br>')
|
||||
$('<input type="checkbox" name="ignore_encoding_errors" style="margin-top: -3px">\
|
||||
<span> Ignore Encoding Errors</span><br><br>')
|
||||
.insertBefore('#dit-upload-area form input[type="submit"]')
|
||||
|
||||
// rename button
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ Field.prototype.set_description = function(txt) {
|
|||
}
|
||||
}
|
||||
|
||||
Field.prototype.get_status = function() {
|
||||
Field.prototype.get_status = function(explain) {
|
||||
// if used in filters
|
||||
if(this.in_filter)
|
||||
this.not_in_form = this.in_filter;
|
||||
|
|
@ -150,16 +150,22 @@ Field.prototype.get_status = function() {
|
|||
else
|
||||
ret='None';
|
||||
|
||||
if(explain) console.log("By Permission:" + ret)
|
||||
|
||||
// hidden
|
||||
if(cint(this.df.hidden)) {
|
||||
ret = 'None';
|
||||
}
|
||||
|
||||
if(explain) console.log("By Hidden:" + ret)
|
||||
|
||||
// for submit
|
||||
if(ret=='Write' && cint(cur_frm.doc.docstatus) > 0) {
|
||||
ret = 'Read';
|
||||
}
|
||||
|
||||
if(explain) console.log("By Submit:" + ret)
|
||||
|
||||
// allow on submit
|
||||
var a_o_s = cint(this.df.allow_on_submit);
|
||||
|
||||
|
|
@ -172,12 +178,16 @@ Field.prototype.get_status = function() {
|
|||
a_o_s = _f.cur_grid.field.df.allow_on_submit;
|
||||
}
|
||||
}
|
||||
|
||||
if(explain) console.log("Allow on Submit:" + a_o_s)
|
||||
|
||||
if(ret=="Read" && a_o_s && cint(cur_frm.doc.docstatus)==1 &&
|
||||
cur_frm.perm[this.df.permlevel][WRITE]) {
|
||||
ret='Write';
|
||||
}
|
||||
|
||||
if(explain) console.log("By Allow on Submt:" + ret)
|
||||
|
||||
// workflow state
|
||||
if(ret=="Write" && cur_frm && cur_frm.state_fieldname) {
|
||||
if(cint(cur_frm.read_only)) {
|
||||
|
|
@ -189,13 +199,17 @@ Field.prototype.get_status = function() {
|
|||
ret = 'Read';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(explain) console.log("By Workflow:" + ret)
|
||||
|
||||
// make a field read_only if read_only
|
||||
// is checked (disregards write permission)
|
||||
if(ret=="Write" && cint(this.df.read_only)) {
|
||||
ret = "Read";
|
||||
}
|
||||
|
||||
if(explain) console.log("By Read Only:" + ret)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -429,7 +429,8 @@ _f.Grid.prototype.notify_keypress = function(e, keycode) {
|
|||
}
|
||||
|
||||
_f.Grid.prototype.make_template = function(hc) {
|
||||
hc.template = make_field(wn.meta.get_docfield(hc.doctype, hc.fieldname), hc.doctype, '', this.field.frm, true);
|
||||
hc.template = make_field(wn.meta.get_docfield(hc.doctype, hc.fieldname), hc.doctype,
|
||||
'', this.field.frm, true);
|
||||
hc.template.grid = this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue