Bläddra i källkod

Merge pull request #398 from nabinhait/hotfix

Added missing field in Custom Field compared to DocField
version-14
Nabin Hait 11 år sedan
förälder
incheckning
63ac6376fc
3 ändrade filer med 36 tillägg och 5 borttagningar
  1. +2
    -1
      core/doctype/custom_field/custom_field.js
  2. +5
    -2
      core/doctype/custom_field/custom_field.py
  3. +29
    -2
      core/doctype/custom_field/custom_field.txt

+ 2
- 1
core/doctype/custom_field/custom_field.js Visa fil

@@ -6,8 +6,9 @@
// -------- // --------


cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.toggle_enable('dt', doc.__islocal)
cur_frm.toggle_enable('dt', doc.__islocal);
cur_frm.cscript.dt(doc, cdt, cdn); cur_frm.cscript.dt(doc, cdt, cdn);
cur_frm.toggle_reqd('label', !doc.fieldname);
} }






+ 5
- 2
core/doctype/custom_field/custom_field.py Visa fil

@@ -3,8 +3,8 @@


from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes

from webnotes.utils import cint, cstr from webnotes.utils import cint, cstr
from webnotes import _


class DocType: class DocType:
def __init__(self, d, dl): def __init__(self, d, dl):
@@ -16,8 +16,11 @@ class DocType:


def set_fieldname(self): def set_fieldname(self):
if not self.doc.fieldname: if not self.doc.fieldname:
if not self.doc.label:
webnotes.throw(_("Label is mandatory"))
# remove special characters from fieldname # remove special characters from fieldname
self.doc.fieldname = filter(lambda x: x.isdigit() or x.isalpha() or '_', cstr(self.doc.label).lower().replace(' ','_'))
self.doc.fieldname = filter(lambda x: x.isdigit() or x.isalpha() or '_',
cstr(self.doc.label).lower().replace(' ','_'))


def validate(self): def validate(self):
from webnotes.model.doctype import get from webnotes.model.doctype import get


+ 29
- 2
core/doctype/custom_field/custom_field.txt Visa fil

@@ -2,7 +2,7 @@
{ {
"creation": "2013-01-10 16:34:01", "creation": "2013-01-10 16:34:01",
"docstatus": 0, "docstatus": 0,
"modified": "2014-01-10 15:04:04",
"modified": "2014-01-13 17:59:15",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@@ -83,7 +83,7 @@
"no_copy": 1, "no_copy": 1,
"oldfieldname": "label", "oldfieldname": "label",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"reqd": 1,
"reqd": 0,
"search_index": 0 "search_index": 0
}, },
{ {
@@ -246,6 +246,15 @@
"oldfieldtype": "Check", "oldfieldtype": "Check",
"search_index": 0 "search_index": 0
}, },
{
"doctype": "DocField",
"fieldname": "print_width",
"fieldtype": "Data",
"hidden": 1,
"label": "Print Width",
"no_copy": 1,
"print_hide": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "report_hide", "fieldname": "report_hide",
@@ -277,6 +286,24 @@
"oldfieldtype": "Int", "oldfieldtype": "Int",
"search_index": 0 "search_index": 0
}, },
{
"doctype": "DocField",
"fieldname": "depends_on",
"fieldtype": "Data",
"hidden": 0,
"label": "Depends On",
"no_copy": 1,
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "search_index",
"fieldtype": "Check",
"hidden": 1,
"label": "Index",
"no_copy": 1,
"print_hide": 1
},
{ {
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Administrator" "role": "Administrator"


Laddar…
Avbryt
Spara