瀏覽代碼

fixes to rename_tool, added serial no for rename

version-14
Rushabh Mehta 12 年之前
父節點
當前提交
8c46ee4e43
共有 5 個文件被更改,包括 21 次插入3 次删除
  1. +2
    -0
      core/doctype/doctype/doctype.py
  2. +7
    -0
      public/js/legacy/widgets/form/fields.js
  3. +0
    -1
      public/js/wn/views/doclistview.js
  4. +2
    -1
      public/js/wn/views/reportview.js
  5. +10
    -1
      webnotes/model/rename_doc.py

+ 2
- 0
core/doctype/doctype/doctype.py 查看文件

@@ -192,6 +192,8 @@ def validate_fields(fields):
if not d.options: if not d.options:
webnotes.msgprint("""#%(idx)s %(label)s: Options must be specified for Link and Table type fields""" % d.fields, webnotes.msgprint("""#%(idx)s %(label)s: Options must be specified for Link and Table type fields""" % d.fields,
raise_exception=1) raise_exception=1)
if d.options=="[Select]":
return
if not webnotes.conn.exists("DocType", d.options): if not webnotes.conn.exists("DocType", d.options):
webnotes.msgprint("""#%(idx)s %(label)s: Options %(options)s must be a valid "DocType" for Link and Table type fields""" % d.fields, webnotes.msgprint("""#%(idx)s %(label)s: Options %(options)s must be a valid "DocType" for Link and Table type fields""" % d.fields,
raise_exception=1) raise_exception=1)


+ 7
- 0
public/js/legacy/widgets/form/fields.js 查看文件

@@ -709,6 +709,13 @@ LinkField.prototype.set_input_value = function(val) {
LinkField.prototype.validate_link = function(val, from_selector) { LinkField.prototype.validate_link = function(val, from_selector) {
// validate the value just entered // validate the value just entered
var me = this; var me = this;

if(this.df.options=="[Select]") {
$(me.txt).val(val);
me.run_trigger();
return;
}

var fetch = ''; var fetch = '';
if(cur_frm.fetch_dict[me.df.fieldname]) if(cur_frm.fetch_dict[me.df.fieldname])
fetch = cur_frm.fetch_dict[me.df.fieldname].columns.join(', '); fetch = cur_frm.fetch_dict[me.df.fieldname].columns.join(', ');


+ 0
- 1
public/js/wn/views/doclistview.js 查看文件

@@ -196,7 +196,6 @@ wn.views.DocListView = wn.ui.Listing.extend({
function(inp) { function(inp) {
return $(inp).attr('data-docstatus'); return $(inp).attr('data-docstatus');
}) : [] }) : []
console.log(docstatus_list)
var args = { var args = {
doctype: this.doctype, doctype: this.doctype,


+ 2
- 1
public/js/wn/views/reportview.js 查看文件

@@ -55,8 +55,9 @@ wn.views.ReportView = wn.ui.Listing.extend({
}, },
setup: function() { setup: function() {
var me = this; var me = this;
this.page_title = 'Report: ' + (this.docname ? (this.doctype + ' - ' + this.docname) : this.doctype);
this.page.appframe.set_title(this.page_title)
this.make({ this.make({
title: 'Report: ' + (this.docname ? (this.doctype + ' - ' + this.docname) : this.doctype),
appframe: this.page.appframe, appframe: this.page.appframe,
method: 'webnotes.widgets.doclistview.get', method: 'webnotes.widgets.doclistview.get',
get_args: this.get_args, get_args: this.get_args,


+ 10
- 1
webnotes/model/rename_doc.py 查看文件

@@ -8,9 +8,18 @@ def rename_doc(doctype, old, new, is_doctype=0, debug=0):
""" """
import webnotes.utils import webnotes.utils
import webnotes.model.doctype import webnotes.model.doctype
from webnotes.model.code import get_obj
if webnotes.conn.exists(doctype, new):
webnotes.msgprint("%s: %s exists, select a new, new name." % (doctype, new))
# get doclist of given doctype
# without child fields of table type fields (form=0) # without child fields of table type fields (form=0)
# call on_rename method if exists
obj = get_obj(doctype, old)
if hasattr(obj, 'on_rename'):
obj.on_rename(new, old)

# get doclist of given doctype
doclist = webnotes.model.doctype.get(doctype, form=0) doclist = webnotes.model.doctype.get(doctype, form=0)
# rename the doc # rename the doc


Loading…
取消
儲存