From f1b346a3d946293f867773a7e1ac6421c440424d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 11 Feb 2013 19:31:05 +0530 Subject: [PATCH 1/4] fix in add custom button for customize form --- core/doctype/customize_form/customize_form.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/doctype/customize_form/customize_form.js b/core/doctype/customize_form/customize_form.js index 81a5cf2692..ea9c3e8234 100644 --- a/core/doctype/customize_form/customize_form.js +++ b/core/doctype/customize_form/customize_form.js @@ -57,16 +57,16 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { } }); } - },1); + }); cur_frm.add_custom_button('Refresh Form', function() { cur_frm.cscript.doc_type(doc, dt, dn); - }, 1); + }); cur_frm.add_custom_button('Reset to defaults', function() { cur_frm.confirm('This will remove the customizations defined for this form.

' + 'Are you sure you want to reset to defaults?', doc, dt, dn); - }, 1); + }); if(!doc.doc_type) { var frm_head = cur_frm.frm_head.appframe; From db34f64ffa90d0cca6d3f91cce2f8b992d83f4a2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 11 Feb 2013 20:21:16 +0530 Subject: [PATCH 2/4] changed calls to cur_frm.call in customize form --- core/doctype/customize_form/customize_form.js | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/core/doctype/customize_form/customize_form.js b/core/doctype/customize_form/customize_form.js index ea9c3e8234..2dca543feb 100644 --- a/core/doctype/customize_form/customize_form.js +++ b/core/doctype/customize_form/customize_form.js @@ -21,8 +21,12 @@ // cur_frm.cscript.doc_type = function(doc, dt, dn) { - $c_obj(make_doclist(dt, dn), 'get', '', function(r, rt) { - cur_frm.refresh(); + cur_frm.call({ + method: "get", + doc: cur_frm.doc, + callback: function(r) { + cur_frm.refresh(); + } }); } @@ -45,17 +49,17 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { cur_frm.frm_head.appframe.clear_buttons(); cur_frm.add_custom_button('Update', function() { - if(cur_frm.fields_dict['doc_type'].value) { - $c_obj(make_doclist(dt, dn), 'post', '', function(r, rt) { - if(r.exc) { - //msgprint(r.exc); - } else { - if(r.server_messages) { + if(cur_frm.doc.doc_type) { + cur_frm.call({ + doc: cur_frm.doc, + method: "post", + callback: function(r) { + if(!r.exc && r.server_messages) { cur_frm.cscript.doc_type(doc, doc.doctype, doc.name); cur_frm.frm_head.set_label(['Updated', 'label-success']); - } + } } - }); + }); } }); @@ -112,16 +116,19 @@ cur_frm.confirm = function(msg, doc, dt, dn) { $y(button_wrapper, {paddingTop: '15px'}); var proceed_btn = $btn(button_wrapper, 'Proceed', function() { - $c_obj(make_doclist(dt, dn), 'delete', '', function(r, rt) { - //console.log(arguments); - if(r.exc) { - msgprint(r.exc); - } else { - cur_frm.confirm.dialog.hide(); - cur_frm.refresh(); - cur_frm.frm_head.set_label(['Saved', 'label-success']); + cur_frm.call({ + doc: cur_frm.doc, + method: "delete", + callback: function(r) { + if(r.exc) { + msgprint(r.exc); + } else { + cur_frm.confirm.dialog.hide(); + cur_frm.refresh(); + cur_frm.frm_head.set_label(['Saved', 'label-success']); + } } - }); + }); }); $y(proceed_btn, {marginRight: '20px', fontWeight: 'bold'}); From bdfd91611012af132dce8064b008f051e49b17dd Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 12 Feb 2013 11:29:03 +0530 Subject: [PATCH 3/4] fix in grid - do not copy docfield for each cell --- public/js/legacy/widgets/form/grid.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/js/legacy/widgets/form/grid.js b/public/js/legacy/widgets/form/grid.js index c92a76ebb1..2a909b78be 100644 --- a/public/js/legacy/widgets/form/grid.js +++ b/public/js/legacy/widgets/form/grid.js @@ -244,7 +244,6 @@ _f.Grid.prototype.set_cell_value = function(cell) { // variations if(cell.cellIndex) { - var df = copy_dict(hc); $(cell.div).html(wn.format(v, hc, {for_print:true})); } else { // Index column From 87a7d882cb463a5ec5df2682224fe687e3899718 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 12 Feb 2013 12:35:47 +0530 Subject: [PATCH 4/4] allow user properties that start with default_ and parent_ --- core/page/user_properties/user_properties.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/page/user_properties/user_properties.py b/core/page/user_properties/user_properties.py index 073d021de8..ed9cfa25c2 100644 --- a/core/page/user_properties/user_properties.py +++ b/core/page/user_properties/user_properties.py @@ -14,7 +14,7 @@ def get_users_and_links(): and tabDocField.parent not in ('[Select]', 'DocType', 'Module Def') """) + webnotes.conn.sql("""select fieldname, options from `tabCustom Field` where fieldtype='Link'"""): - if not l[0] in all_fields and not l[0].startswith("default_") and not l[0].startswith("parent_"): + if not l[0] in all_fields: links.append([l[0], l[1]]) all_fields.append(l[0])