Explorar el Código

Merge pull request #398 from nabinhait/hotfix

Added missing field in Custom Field compared to DocField
version-14
Nabin Hait hace 11 años
padre
commit
63ac6376fc
Se han modificado 3 ficheros con 36 adiciones y 5 borrados
  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 Ver fichero

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

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.toggle_reqd('label', !doc.fieldname);
}




+ 5
- 2
core/doctype/custom_field/custom_field.py Ver fichero

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

from __future__ import unicode_literals
import webnotes

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

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

def set_fieldname(self):
if not self.doc.fieldname:
if not self.doc.label:
webnotes.throw(_("Label is mandatory"))
# 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):
from webnotes.model.doctype import get


+ 29
- 2
core/doctype/custom_field/custom_field.txt Ver fichero

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


Cargando…
Cancelar
Guardar