Limit varchar length to 140 instead of 255 to mitigate Row Size Too Large error
This commit is contained in:
parent
13f434b6b4
commit
3c4f31a23c
78 changed files with 434 additions and 98 deletions
|
|
@ -243,7 +243,7 @@ def msgprint(msg, small=0, raise_exception=0, as_table=False):
|
|||
if as_table and type(msg) in (list, tuple):
|
||||
msg = '<table border="1px" style="border-collapse: collapse" cellpadding="2px">' + ''.join(['<tr>'+''.join(['<td>%s</td>' % c for c in r])+'</tr>' for r in msg]) + '</table>'
|
||||
|
||||
if flags.print_messages:
|
||||
if flags.print_messages or not request or (not "cmd" in local.form_dict):
|
||||
print "Message: " + repr(msg).encode("utf-8")
|
||||
|
||||
message_log.append((small and '__small:' or '')+cstr(msg or ''))
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Status",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nQueued\nRunning\nSucceeded\nFailed\n",
|
||||
"permlevel": 0,
|
||||
|
|
@ -195,7 +196,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-07 08:08:22.193911",
|
||||
"modified": "2015-10-02 07:38:38.658939",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Async Task",
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-03-24 16:03:52.359042",
|
||||
"modified": "2015-10-02 07:38:39.485971",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Block Module",
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-06-08 12:31:15.122312",
|
||||
"modified": "2015-10-02 07:38:41.308408",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Comment",
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Series",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "COMM-",
|
||||
"permlevel": 0,
|
||||
|
|
@ -45,6 +46,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Communication Medium",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nChat\nPhone\nEmail\nSMS\nVisit\nOther",
|
||||
"permlevel": 0,
|
||||
|
|
@ -154,6 +156,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Status",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "Open\nReplied\nClosed\nLinked",
|
||||
"permlevel": 0,
|
||||
|
|
@ -177,6 +180,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Sent or Received",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "Sent\nReceived",
|
||||
"permlevel": 0,
|
||||
|
|
@ -200,6 +204,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Delivery Status",
|
||||
"length": 30,
|
||||
"no_copy": 0,
|
||||
"options": "\nSent\nBounced\nOpened\nMarked As Spam\nRejected\nDelayed\nSoft-Bounced\nClicked\nRecipient Unsubscribed",
|
||||
"permlevel": 0,
|
||||
|
|
@ -573,7 +578,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-24 02:27:43.536919",
|
||||
"modified": "2015-10-02 07:38:41.472917",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Communication",
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-02-19 01:06:59.622792",
|
||||
"modified": "2015-10-02 07:38:44.346115",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "DefaultValue",
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "fieldtype",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -140,6 +141,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Precision",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\n1\n2\n3\n4\n5\n6\n7\n8\n9",
|
||||
"permlevel": 0,
|
||||
|
|
@ -151,6 +153,29 @@
|
|||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"depends_on": "eval:in_list(['Data', 'Link', 'Dynamic Link', 'Password', 'Select', 'Read Only', 'Attach', 'Attach Image'], doc.fieldtype)",
|
||||
"fieldname": "length",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Length",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
|
|
@ -256,6 +281,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Collapsible Depends On",
|
||||
"length": 255,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
|
|
@ -366,6 +392,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Depends On",
|
||||
"length": 255,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "depends_on",
|
||||
"oldfieldtype": "Data",
|
||||
|
|
@ -828,7 +855,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-08-20 16:05:15.274200",
|
||||
"modified": "2015-10-02 07:38:45.729926",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "DocField",
|
||||
|
|
|
|||
|
|
@ -591,7 +591,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-07-22 07:39:40.471092",
|
||||
"modified": "2015-10-02 07:38:46.740536",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "DocPerm",
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-17 07:02:10.632582",
|
||||
"modified": "2015-10-02 07:38:47.029636",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "DocShare",
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Document Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "document_type",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -313,6 +314,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Name Case",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "name_case",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -449,6 +451,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Sort Order",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "ASC\nDESC",
|
||||
"permlevel": 0,
|
||||
|
|
@ -851,7 +854,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-28 16:18:11.925264",
|
||||
"modified": "2015-10-02 07:38:47.199387",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "DocType",
|
||||
|
|
|
|||
12
frappe/core/doctype/doctype/test_doctype.py
Normal file
12
frappe/core/doctype/doctype/test_doctype.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('DocType')
|
||||
|
||||
class TestDocType(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -455,7 +455,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-10-07 05:52:52.922698",
|
||||
"modified": "2015-10-08 05:52:52.922698",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "File",
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:41.388856",
|
||||
"modified": "2015-10-02 07:38:57.452736",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Module Def",
|
||||
|
|
|
|||
12
frappe/core/doctype/module_def/test_module_def.py
Normal file
12
frappe/core/doctype/module_def/test_module_def.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Module Def')
|
||||
|
||||
class TestModuleDef(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -150,6 +150,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Standard",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "standard",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -217,7 +218,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-11 12:19:55.121822",
|
||||
"modified": "2015-10-02 07:38:59.403028",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Page",
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-02-19 01:07:00.897854",
|
||||
"modified": "2015-10-02 07:38:59.530013",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Page Role",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "patch",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2013-12-20 19:24:15",
|
||||
"modified": "2015-10-02 07:38:59.666628",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Patch Log",
|
||||
|
|
|
|||
12
frappe/core/doctype/patch_log/test_patch_log.py
Normal file
12
frappe/core/doctype/patch_log/test_patch_log.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Patch Log')
|
||||
|
||||
class TestPatchLog(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -63,6 +63,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Is Standard",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "No\nYes",
|
||||
"permlevel": 0,
|
||||
|
|
@ -148,6 +149,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Report Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "Report Builder\nQuery Report\nScript Report",
|
||||
"permlevel": 0,
|
||||
|
|
@ -300,7 +302,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified": "2015-10-02 07:39:07.933259",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Report",
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified": "2015-10-02 07:39:08.074305",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Role",
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-05-28 02:49:12.819934",
|
||||
"modified": "2015-10-02 07:39:12.348067",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Scheduler Log",
|
||||
|
|
|
|||
|
|
@ -575,6 +575,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Background Style",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "Fill Screen\nTile",
|
||||
"permlevel": 0,
|
||||
|
|
@ -619,6 +620,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Gender",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "gender",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -934,6 +936,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "User Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "user_type",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -1263,7 +1266,7 @@
|
|||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 5,
|
||||
"modified": "2015-08-18 11:58:00.000691",
|
||||
"modified": "2015-10-02 07:39:17.752070",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "User",
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-02-19 01:07:02.561834",
|
||||
"modified": "2015-10-02 07:39:18.179539",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "UserRole",
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-28 16:18:12.706419",
|
||||
"modified": "2015-10-02 07:39:18.235343",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "Version",
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@
|
|||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Field Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "fieldtype",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -139,6 +140,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Precision",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\n1\n2\n3\n4\n5\n6\n7\n8\n9",
|
||||
"permlevel": 0,
|
||||
|
|
@ -656,7 +658,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-25 03:39:23.573928",
|
||||
"modified": "2015-10-02 07:38:43.093000",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Custom",
|
||||
"name": "Custom Field",
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Script Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "script_type",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -114,7 +115,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-27 06:36:20.439949",
|
||||
"modified": "2015-10-02 07:38:43.345211",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Custom",
|
||||
"name": "Custom Script",
|
||||
|
|
|
|||
12
frappe/custom/doctype/custom_script/test_custom_script.py
Normal file
12
frappe/custom/doctype/custom_script/test_custom_script.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Custom Script')
|
||||
|
||||
class TestCustomScript(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -235,6 +235,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Sort Order",
|
||||
"length": 4,
|
||||
"no_copy": 0,
|
||||
"options": "ASC\nDESC",
|
||||
"permlevel": 0,
|
||||
|
|
@ -301,7 +302,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-27 01:00:32.901851",
|
||||
"modified": "2015-10-02 07:17:18.939161",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Custom",
|
||||
"name": "Customize Form",
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ class CustomizeForm(Document):
|
|||
'description': 'Text',
|
||||
'default': 'Text',
|
||||
'precision': 'Select',
|
||||
'read_only': 'Check'
|
||||
'read_only': 'Check',
|
||||
'length': 'Int'
|
||||
}
|
||||
|
||||
allowed_fieldtype_change = (('Currency', 'Float', 'Percent'), ('Small Text', 'Data'),
|
||||
|
|
|
|||
|
|
@ -65,10 +65,11 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "fieldtype",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Attach\nButton\nCheck\nCode\nColumn Break\nCurrency\nData\nDate\nDatetime\nDynamic Link\nFloat\nFold\nHTML\nImage\nInt\nLink\nLong Text\nPassword\nPercent\nRead Only\nSection Break\nSelect\nSmall Text\nTable\nText\nText Editor\nTime",
|
||||
"options": "Attach\nAttach Image\nButton\nCheck\nCode\nColumn Break\nCurrency\nData\nDate\nDatetime\nDynamic Link\nFloat\nFold\nHeading\nHTML\nImage\nInt\nLink\nLong Text\nPassword\nPercent\nRead Only\nSection Break\nSelect\nSmall Text\nTable\nText\nText Editor\nTime",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
|
|
@ -203,6 +204,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Precision",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\n1\n2\n3\n4\n5\n6\n7\n8\n9",
|
||||
"permlevel": 0,
|
||||
|
|
@ -215,6 +217,29 @@
|
|||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"depends_on": "eval:in_list(['Data', 'Link', 'Dynamic Link', 'Password', 'Select', 'Read Only', 'Attach', 'Attach Image'], doc.fieldtype)",
|
||||
"fieldname": "length",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Length",
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
|
|
@ -709,7 +734,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-10-01 07:59:15.490247",
|
||||
"modified": "2015-10-03 07:38:44.026280",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Custom",
|
||||
"name": "Customize Form Field",
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "DocType or Field",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nDocField\nDocType",
|
||||
"permlevel": 0,
|
||||
|
|
@ -233,7 +234,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:11:43.216164",
|
||||
"modified": "2015-10-02 07:39:02.618929",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Custom",
|
||||
"name": "Property Setter",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Property Setter')
|
||||
|
||||
class TestPropertySetter(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -48,6 +48,7 @@ CREATE TABLE `tabDocField` (
|
|||
`in_list_view` int(1) NOT NULL DEFAULT 0,
|
||||
`read_only` int(1) NOT NULL DEFAULT 0,
|
||||
`precision` varchar(255) DEFAULT NULL,
|
||||
`length` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`name`),
|
||||
KEY `parent` (`parent`),
|
||||
KEY `label` (`label`),
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Event Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "event_type",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -254,6 +255,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Repeat On",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nEvery Day\nEvery Week\nEvery Month\nEvery Year",
|
||||
"permlevel": 0,
|
||||
|
|
@ -635,7 +637,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified": "2015-10-02 07:38:49.897665",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "Event",
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-02-19 01:07:00.166770",
|
||||
"modified": "2015-10-02 07:38:50.115057",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "Event Role",
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Feed Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nComment\nLogin\nLabel\nInfo",
|
||||
"permlevel": 0,
|
||||
|
|
@ -77,7 +78,7 @@
|
|||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "subject",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
|
|
@ -145,7 +146,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified": "2015-10-02 07:38:50.611929",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "Feed",
|
||||
|
|
|
|||
12
frappe/desk/doctype/feed/test_feed.py
Normal file
12
frappe/desk/doctype/feed/test_feed.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Feed')
|
||||
|
||||
class TestFeed(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-11 12:20:04.912891",
|
||||
"modified": "2015-10-02 07:38:57.968895",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "Note",
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Status",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "Open\nClosed",
|
||||
"permlevel": 0,
|
||||
|
|
@ -109,6 +110,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Priority",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "priority",
|
||||
"oldfieldtype": "Data",
|
||||
|
|
@ -335,7 +337,7 @@
|
|||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified": "2015-10-02 07:39:17.248993",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "ToDo",
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Status",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nNot Sent\nSending\nSent\nError",
|
||||
"permlevel": 0,
|
||||
|
|
@ -215,7 +216,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-29 05:16:31.857121",
|
||||
"modified": "2015-10-02 07:38:40.795371",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Email",
|
||||
"name": "Bulk Email",
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Service",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nGMail\nYahoo Mail\nOutlook.com",
|
||||
"permlevel": 0,
|
||||
|
|
@ -780,7 +781,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-18 01:34:31.784444",
|
||||
"modified": "2015-10-02 07:38:47.651995",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Email",
|
||||
"name": "Email Account",
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Send Alert On",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nNew\nSave\nSubmit\nCancel\nDays After\nDays Before\nValue Change",
|
||||
"permlevel": 0,
|
||||
|
|
@ -411,7 +412,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-09 00:27:00.169741",
|
||||
"modified": "2015-10-02 07:38:47.925050",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Email",
|
||||
"name": "Email Alert",
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2014-07-11 17:54:53.298536",
|
||||
"modified": "2015-10-02 07:38:48.185785",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Email",
|
||||
"name": "Email Alert Recipient",
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-08-05 06:02:12.805282",
|
||||
"modified": "2015-10-02 07:38:48.744583",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Email",
|
||||
"name": "Email Unsubscribe",
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified": "2015-10-02 07:39:13.407883",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Email",
|
||||
"name": "Standard Reply",
|
||||
|
|
|
|||
12
frappe/email/doctype/standard_reply/test_standard_reply.py
Normal file
12
frappe/email/doctype/standard_reply/test_standard_reply.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Standard Reply')
|
||||
|
||||
class TestStandardReply(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -47,6 +47,7 @@ class MandatoryError(ValidationError): pass
|
|||
class InvalidSignatureError(ValidationError): pass
|
||||
class RateLimitExceededError(ValidationError): pass
|
||||
class CannotChangeConstantError(ValidationError): pass
|
||||
class CharacterLengthExceededError(ValidationError): pass
|
||||
class UpdateAfterSubmitError(ValidationError): pass
|
||||
class LinkValidationError(ValidationError): pass
|
||||
class CancelledLinkError(LinkValidationError): pass
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified": "2015-10-02 07:38:42.770807",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Geo",
|
||||
"name": "Country",
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Number Format",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\n#,###.##\n#.###,##\n# ###.##\n# ###,##\n#'###.##\n#, ###.##\n#,##,###.##\n#,###.###\n#.###\n#,###",
|
||||
"permlevel": 0,
|
||||
|
|
@ -153,7 +154,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-14 03:17:04.837607",
|
||||
"modified": "2015-10-02 07:38:42.863135",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Geo",
|
||||
"name": "Currency",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from frappe.model import default_fields
|
|||
from frappe.model.naming import set_new_name
|
||||
from frappe.modules import load_doctype_module
|
||||
from frappe.model import display_fieldtypes
|
||||
from frappe.model.db_schema import type_map, varchar_len
|
||||
|
||||
_classes = {}
|
||||
|
||||
|
|
@ -444,6 +445,25 @@ class BaseDocument(object):
|
|||
frappe.throw(_("Value cannot be changed for {0}").format(self.meta.get_label(fieldname)),
|
||||
frappe.CannotChangeConstantError)
|
||||
|
||||
def _validate_length(self):
|
||||
if frappe.flags.in_install:
|
||||
return
|
||||
|
||||
for fieldname, value in self.get_valid_dict().iteritems():
|
||||
df = self.meta.get_field(fieldname)
|
||||
if df and df.fieldtype in type_map and type_map[df.fieldtype][0]=="varchar":
|
||||
max_length = cint(df.get("length")) or cint(varchar_len)
|
||||
|
||||
if len(cstr(value)) > max_length:
|
||||
if self.parentfield and self.idx:
|
||||
reference = _("{0}, Row {1}").format(_(self.doctype), self.idx)
|
||||
|
||||
else:
|
||||
reference = "{0} {1}".format(_(self.doctype), self.name)
|
||||
|
||||
frappe.throw(_("{0}: '{1}' will get truncated, as max characters allowed is {2}")\
|
||||
.format(reference, _(df.label), max_length), frappe.CharacterLengthExceededError)
|
||||
|
||||
def _validate_update_after_submit(self):
|
||||
# get the full doc with children
|
||||
db_values = frappe.get_doc(self.doctype, self.name).as_dict()
|
||||
|
|
|
|||
|
|
@ -13,9 +13,13 @@ import os
|
|||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import cstr, cint
|
||||
import MySQLdb
|
||||
|
||||
class InvalidColumnName(frappe.ValidationError): pass
|
||||
|
||||
varchar_len = '140'
|
||||
standard_varchar_columns = ('name', 'owner', 'modified_by', 'parent', 'parentfield', 'parenttype')
|
||||
|
||||
type_map = {
|
||||
'Currency': ('decimal', '18,6')
|
||||
,'Int': ('int', '11')
|
||||
|
|
@ -30,14 +34,14 @@ type_map = {
|
|||
,'Datetime': ('datetime', '6')
|
||||
,'Time': ('time', '6')
|
||||
,'Text': ('text', '')
|
||||
,'Data': ('varchar', '255')
|
||||
,'Link': ('varchar', '255')
|
||||
,'Dynamic Link':('varchar', '255')
|
||||
,'Password': ('varchar', '255')
|
||||
,'Select': ('varchar', '255')
|
||||
,'Read Only': ('varchar', '255')
|
||||
,'Attach': ('varchar', '255')
|
||||
,'Attach Image':('varchar', '255')
|
||||
,'Data': ('varchar', varchar_len)
|
||||
,'Link': ('varchar', varchar_len)
|
||||
,'Dynamic Link':('varchar', varchar_len)
|
||||
,'Password': ('varchar', varchar_len)
|
||||
,'Select': ('varchar', varchar_len)
|
||||
,'Read Only': ('varchar', varchar_len)
|
||||
,'Attach': ('varchar', varchar_len)
|
||||
,'Attach Image':('varchar', varchar_len)
|
||||
}
|
||||
|
||||
default_columns = ['name', 'creation', 'modified', 'modified_by', 'owner',
|
||||
|
|
@ -57,8 +61,10 @@ def updatedb(dt):
|
|||
raise Exception, 'Wrong doctype "%s" in updatedb' % dt
|
||||
|
||||
if not res[0][0]:
|
||||
frappe.db.commit()
|
||||
tab = DbTable(dt, 'tab')
|
||||
tab.validate()
|
||||
|
||||
frappe.db.commit()
|
||||
tab.sync()
|
||||
frappe.db.begin()
|
||||
|
||||
|
|
@ -80,12 +86,57 @@ class DbTable:
|
|||
# load
|
||||
self.get_columns_from_docfields()
|
||||
|
||||
def validate(self):
|
||||
"""Check if change in varchar length isn't truncating the columns"""
|
||||
if self.is_new():
|
||||
return
|
||||
|
||||
self.get_columns_from_db()
|
||||
|
||||
columns = [frappe._dict({"fieldname": f, "fieldtype": "Data"}) for f in standard_varchar_columns]
|
||||
columns += self.columns.values()
|
||||
|
||||
for col in columns:
|
||||
if col.fieldtype in type_map and type_map[col.fieldtype][0]=="varchar":
|
||||
|
||||
# validate length range
|
||||
new_length = cint(col.length) or cint(varchar_len)
|
||||
if not (1 <= new_length <= 255):
|
||||
frappe.throw(_("Length of {0} should be between 1 and 255").format(col.fieldname))
|
||||
|
||||
try:
|
||||
# check for truncation
|
||||
max_length = frappe.db.sql("""select max(length(`{fieldname}`)) from `tab{doctype}`"""\
|
||||
.format(fieldname=col.fieldname, doctype=self.doctype))
|
||||
|
||||
except MySQLdb.OperationalError, e:
|
||||
if e.args[0]==1054:
|
||||
# Unknown column 'column_name' in 'field list'
|
||||
continue
|
||||
|
||||
else:
|
||||
raise
|
||||
|
||||
if max_length and max_length[0][0] > new_length:
|
||||
current_type = self.current_columns[col.fieldname]["type"]
|
||||
current_length = re.findall('varchar\(([\d]+)\)', current_type)[0]
|
||||
|
||||
if col.fieldname in self.columns:
|
||||
self.columns[col.fieldname].length = current_length
|
||||
|
||||
frappe.msgprint(_("Reverting length to {0} for '{1}' in '{2}'; Setting the length as {3} will cause truncation of data.")\
|
||||
.format(current_length, col.fieldname, self.doctype, new_length))
|
||||
|
||||
|
||||
def sync(self):
|
||||
if not self.name in DbManager(frappe.db).get_tables_list(frappe.db.cur_db_name):
|
||||
if self.is_new():
|
||||
self.create()
|
||||
else:
|
||||
self.alter()
|
||||
|
||||
def is_new(self):
|
||||
return self.name not in DbManager(frappe.db).get_tables_list(frappe.db.cur_db_name)
|
||||
|
||||
def create(self):
|
||||
add_text = ''
|
||||
|
||||
|
|
@ -99,21 +150,21 @@ class DbTable:
|
|||
|
||||
# create table
|
||||
frappe.db.sql("""create table `%s` (
|
||||
name varchar(255) not null primary key,
|
||||
name varchar({varchar_len}) not null primary key,
|
||||
creation datetime(6),
|
||||
modified datetime(6),
|
||||
modified_by varchar(255),
|
||||
owner varchar(255),
|
||||
modified_by varchar({varchar_len}),
|
||||
owner varchar({varchar_len}),
|
||||
docstatus int(1) default '0',
|
||||
parent varchar(255),
|
||||
parentfield varchar(255),
|
||||
parenttype varchar(255),
|
||||
parent varchar({varchar_len}),
|
||||
parentfield varchar({varchar_len}),
|
||||
parenttype varchar({varchar_len}),
|
||||
idx int(8),
|
||||
%sindex parent(parent))
|
||||
ENGINE=InnoDB
|
||||
ROW_FORMAT=COMPRESSED
|
||||
CHARACTER SET=utf8mb4
|
||||
COLLATE=utf8mb4_unicode_ci""" % (self.name, add_text))
|
||||
COLLATE=utf8mb4_unicode_ci""".format(varchar_len=varchar_len) % (self.name, add_text))
|
||||
|
||||
def get_column_definitions(self):
|
||||
column_list = [] + default_columns
|
||||
|
|
@ -139,6 +190,7 @@ class DbTable:
|
|||
get columns from docfields and custom fields
|
||||
"""
|
||||
fl = frappe.db.sql("SELECT * FROM tabDocField WHERE parent = %s", self.doctype, as_dict = 1)
|
||||
lengths = {}
|
||||
precisions = {}
|
||||
uniques = {}
|
||||
|
||||
|
|
@ -148,19 +200,26 @@ class DbTable:
|
|||
WHERE dt = %s AND docstatus < 2""", (self.doctype,), as_dict=1)
|
||||
if custom_fl: fl += custom_fl
|
||||
|
||||
# get precision from property setters
|
||||
for ps in frappe.get_all("Property Setter", fields=["field_name", "value"],
|
||||
filters={"doc_type": self.doctype, "doctype_or_field": "DocField", "property": "precision"}):
|
||||
precisions[ps.field_name] = ps.value
|
||||
# apply length, precision and unique from property setters
|
||||
for ps in frappe.get_all("Property Setter", fields=["field_name", "property", "value"],
|
||||
filters={
|
||||
"doc_type": self.doctype,
|
||||
"doctype_or_field": "DocField",
|
||||
"property": ["in", ["precision", "length", "unique"]]
|
||||
}):
|
||||
|
||||
# apply unique from property setters
|
||||
for ps in frappe.get_all("Property Setter", fields=["field_name", "value"],
|
||||
filters={"doc_type": self.doctype, "doctype_or_field": "DocField", "property": "unique"}):
|
||||
if ps.property=="length":
|
||||
lengths[ps.field_name] = cint(ps.value)
|
||||
|
||||
elif ps.property=="precision":
|
||||
precisions[ps.field_name] = cint(ps.value)
|
||||
|
||||
elif ps.property=="unique":
|
||||
uniques[ps.field_name] = cint(ps.value)
|
||||
|
||||
for f in fl:
|
||||
self.columns[f['fieldname']] = DbColumn(self, f['fieldname'],
|
||||
f['fieldtype'], f.get('length'), f.get('default'), f.get('search_index'),
|
||||
f['fieldtype'], lengths.get(f["fieldname"]) or f.get('length'), f.get('default'), f.get('search_index'),
|
||||
f.get('options'), uniques.get(f["fieldname"], f.get('unique')), precisions.get(f['fieldname']) or f.get('precision'))
|
||||
|
||||
def get_columns_from_db(self):
|
||||
|
|
@ -201,7 +260,6 @@ class DbTable:
|
|||
frappe.db.sql("set foreign_key_checks=1")
|
||||
|
||||
def alter(self):
|
||||
self.get_columns_from_db()
|
||||
for col in self.columns.values():
|
||||
col.build_for_alter_table(self.current_columns.get(col.fieldname, None))
|
||||
|
||||
|
|
@ -268,7 +326,7 @@ class DbColumn:
|
|||
self.precision = precision
|
||||
|
||||
def get_definition(self, with_default=1):
|
||||
column_def = get_definition(self.fieldtype, self.precision)
|
||||
column_def = get_definition(self.fieldtype, precision=self.precision, length=self.length)
|
||||
|
||||
if not column_def:
|
||||
return column_def
|
||||
|
|
@ -287,7 +345,7 @@ class DbColumn:
|
|||
return column_def
|
||||
|
||||
def build_for_alter_table(self, current_def):
|
||||
column_def = get_definition(self.fieldtype)
|
||||
column_def = get_definition(self.fieldtype, self.precision, self.length)
|
||||
|
||||
# no columns
|
||||
if not column_def:
|
||||
|
|
@ -471,20 +529,28 @@ def remove_all_foreign_keys():
|
|||
for f in fklist:
|
||||
frappe.db.sql("alter table `tab%s` drop foreign key `%s`" % (t[0], f[1]))
|
||||
|
||||
def get_definition(fieldtype, precision=None):
|
||||
def get_definition(fieldtype, precision=None, length=None):
|
||||
d = type_map.get(fieldtype)
|
||||
|
||||
if not d:
|
||||
return
|
||||
|
||||
ret = d[0]
|
||||
coltype = d[0]
|
||||
size = None
|
||||
if d[1]:
|
||||
length = d[1]
|
||||
if fieldtype in ["Float", "Currency", "Percent"] and cint(precision) > 6:
|
||||
length = '18,9'
|
||||
ret += '(' + length + ')'
|
||||
size = d[1]
|
||||
|
||||
return ret
|
||||
if size:
|
||||
if fieldtype in ["Float", "Currency", "Percent"] and cint(precision) > 6:
|
||||
size = '18,9'
|
||||
|
||||
if coltype == "varchar" and length:
|
||||
size = length
|
||||
|
||||
if size is not None:
|
||||
coltype = "{coltype}({size})".format(coltype=coltype, size=size)
|
||||
|
||||
return coltype
|
||||
|
||||
def add_column(doctype, column_name, fieldtype, precision=None):
|
||||
frappe.db.commit()
|
||||
|
|
|
|||
|
|
@ -337,11 +337,13 @@ class Document(BaseDocument):
|
|||
self._validate_links()
|
||||
self._validate_selects()
|
||||
self._validate_constants()
|
||||
self._validate_length()
|
||||
|
||||
children = self.get_all_children()
|
||||
for d in children:
|
||||
d._validate_selects()
|
||||
d._validate_constants()
|
||||
d._validate_length()
|
||||
|
||||
# extract images after validations to save processing if some validation error is raised
|
||||
self._extract_images_from_text_editor()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ execute:frappe.db.sql("""update `tabPatch Log` set patch=replace(patch, '.4_0.',
|
|||
frappe.patches.v5_0.convert_to_barracuda_and_utf8mb4
|
||||
frappe.patches.v6_1.rename_file_data
|
||||
execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2014-01-24
|
||||
execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2015-08-20
|
||||
execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2015-10-14
|
||||
execute:frappe.reload_doc('core', 'doctype', 'docperm') #2014-06-24
|
||||
execute:frappe.reload_doc('core', 'doctype', 'page') #2013-13-26
|
||||
execute:frappe.reload_doc('core', 'doctype', 'report') #2014-06-03
|
||||
|
|
@ -94,3 +94,4 @@ frappe.patches.v6_2.ignore_user_permissions_if_missing
|
|||
execute:frappe.db.sql("delete from tabSessions where user is null")
|
||||
frappe.patches.v6_2.rename_backup_manager
|
||||
execute:frappe.delete_doc("DocType", "Backup Manager")
|
||||
frappe.patches.v6_4.reduce_varchar_length
|
||||
|
|
|
|||
0
frappe/patches/v6_4/__init__.py
Normal file
0
frappe/patches/v6_4/__init__.py
Normal file
33
frappe/patches/v6_4/reduce_varchar_length.py
Normal file
33
frappe/patches/v6_4/reduce_varchar_length.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for doctype in frappe.get_all("DocType", filters={"issingle": 0}):
|
||||
doctype = doctype.name
|
||||
|
||||
for column in frappe.db.sql("desc `tab{doctype}`".format(doctype=doctype), as_dict=True):
|
||||
fieldname = column["Field"]
|
||||
column_type = column["Type"]
|
||||
|
||||
if not column_type.startswith("varchar"):
|
||||
continue
|
||||
|
||||
max_length = frappe.db.sql("""select max(length(`{fieldname}`)) from `tab{doctype}`"""\
|
||||
.format(fieldname=fieldname, doctype=doctype))
|
||||
|
||||
max_length = max_length[0][0] if max_length else None
|
||||
|
||||
if max_length and max_length > 140:
|
||||
print "setting length of '{fieldname}' in '{doctype}' as {length}".format(
|
||||
fieldname=fieldname, doctype=doctype, length=max_length)
|
||||
|
||||
# create property setter for length
|
||||
frappe.make_property_setter({
|
||||
"doctype": doctype,
|
||||
"fieldname": fieldname,
|
||||
"property": "length",
|
||||
"value": max_length,
|
||||
"property_type": "Int"
|
||||
})
|
||||
|
||||
frappe.clear_cache(doctype=doctype)
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 3,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified": "2015-10-02 07:38:56.001216",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Print",
|
||||
"name": "Letter Head",
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@
|
|||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Standard",
|
||||
"length": 20,
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "standard",
|
||||
"oldfieldtype": "Select",
|
||||
|
|
@ -154,6 +155,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Print Format Type",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "Server\nClient",
|
||||
"permlevel": 0,
|
||||
|
|
@ -269,6 +271,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Font",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "Default\nArial\nHelvetica\nVerdana\nMonospace",
|
||||
"permlevel": 0,
|
||||
|
|
@ -447,7 +450,7 @@
|
|||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-09-09 05:46:11.025962",
|
||||
"modified": "2015-10-02 07:39:00.918464",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Print",
|
||||
"name": "Print Format",
|
||||
|
|
|
|||
|
|
@ -353,6 +353,11 @@ frappe.ui.form.ControlData = frappe.ui.form.ControlInput.extend({
|
|||
.addClass("input-with-feedback form-control")
|
||||
.prependTo(this.input_area)
|
||||
|
||||
if (in_list(['Data', 'Link', 'Dynamic Link', 'Password', 'Select', 'Read Only', 'Attach', 'Attach Image'],
|
||||
this.df.fieldtype)) {
|
||||
this.$input.attr("maxlength", this.df.length || 140);
|
||||
}
|
||||
|
||||
this.set_input_attributes();
|
||||
this.input = this.$input.get(0);
|
||||
this.has_input = true;
|
||||
|
|
|
|||
|
|
@ -150,3 +150,9 @@ class TestDocument(unittest.TestCase):
|
|||
d.load_from_db()
|
||||
d.starts_on = "2014-01-01"
|
||||
d.validate_update_after_submit()
|
||||
|
||||
def test_varchar_length(self):
|
||||
d = self.test_insert()
|
||||
d.subject = "abcde"*100
|
||||
self.assertRaises(frappe.CharacterLengthExceededError, d.save)
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-02-19 09:29:46.804175",
|
||||
"modified": "2015-10-02 07:38:37.354149",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "About Us Team Member",
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-11 12:20:05.555186",
|
||||
"modified": "2015-10-02 07:38:39.540340",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Blog Category",
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@
|
|||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 5,
|
||||
"modified": "2015-09-11 12:19:54.226902",
|
||||
"modified": "2015-10-02 07:38:39.632512",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Blog Post",
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@
|
|||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 1,
|
||||
"modified": "2015-09-07 15:51:26",
|
||||
"modified": "2015-10-02 07:38:39.773633",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Blogger",
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2013-12-20 19:23:01",
|
||||
"modified": "2015-10-02 07:38:42.281395",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Company History",
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Target",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\ntarget = \"_blank\"",
|
||||
"permlevel": 0,
|
||||
|
|
@ -130,7 +131,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-07-07 07:06:26.632888",
|
||||
"modified": "2015-10-02 07:39:17.448972",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Top Bar Item",
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-11 12:20:17.264419",
|
||||
"modified": "2015-10-02 07:39:18.834336",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Web Form",
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Fieldtype",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "Attach\nCheck\nData\nDate\nDatetime\nHTML\nSelect\nText\nSection Break\nColumn Break",
|
||||
"permlevel": 0,
|
||||
|
|
@ -266,7 +267,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-06-03 06:45:30.240450",
|
||||
"modified": "2015-10-02 07:39:19.006591",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Web Form Field",
|
||||
|
|
|
|||
|
|
@ -411,6 +411,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Text Align",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "Left\nCenter\nRight",
|
||||
"permlevel": 0,
|
||||
|
|
@ -608,7 +609,7 @@
|
|||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 20,
|
||||
"modified": "2015-09-11 12:19:37.342904",
|
||||
"modified": "2015-10-02 07:39:19.171402",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Web Page",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Website Slideshow')
|
||||
|
||||
class TestWebsiteSlideshow(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 10,
|
||||
"modified": "2015-07-28 16:18:13.013029",
|
||||
"modified": "2015-10-02 07:39:19.477260",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Website Slideshow",
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 10,
|
||||
"modified": "2015-02-19 09:27:05.003437",
|
||||
"modified": "2015-10-02 07:39:19.556319",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Website Slideshow Item",
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Font Size",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\n12px\n13px\n14px\n15px\n16px\n17px\n18px",
|
||||
"permlevel": 0,
|
||||
|
|
@ -314,6 +315,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Heading Style",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nUPPERCASE\nTitle Case\nlowercase",
|
||||
"permlevel": 0,
|
||||
|
|
@ -643,7 +645,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-14 02:56:01.143058",
|
||||
"modified": "2015-10-02 07:39:19.663446",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Website Theme",
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-09-14 02:56:01.362929",
|
||||
"modified": "2015-10-02 07:39:19.926848",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Workflow",
|
||||
"name": "Workflow",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
# test_records = frappe.get_test_records('Workflow Action')
|
||||
|
||||
class TestWorkflowAction(unittest.TestCase):
|
||||
pass
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-02-05 05:12:45.535606",
|
||||
"modified": "2015-10-02 07:39:20.028302",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Workflow",
|
||||
"name": "Workflow Action",
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Doc Status",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "0\n1\n2",
|
||||
"permlevel": 0,
|
||||
|
|
@ -156,7 +157,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2015-07-28 16:18:13.257862",
|
||||
"modified": "2015-10-02 07:39:20.102069",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Workflow",
|
||||
"name": "Workflow Document State",
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Icon",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nglass\nmusic\nsearch\nenvelope\nheart\nstar\nstar-empty\nuser\nfilm\nth-large\nth\nth-list\nok\nremove\nzoom-in\nzoom-out\noff\nsignal\ncog\ntrash\nhome\nfile\ntime\nroad\ndownload-alt\ndownload\nupload\ninbox\nplay-circle\nrepeat\nrefresh\nlist-alt\nlock\nflag\nheadphones\nvolume-off\nvolume-down\nvolume-up\nqrcode\nbarcode\ntag\ntags\nbook\nbookmark\nprint\ncamera\nfont\nbold\nitalic\ntext-height\ntext-width\nalign-left\nalign-center\nalign-right\nalign-justify\nlist\nindent-left\nindent-right\nfacetime-video\npicture\npencil\nmap-marker\nadjust\ntint\nedit\nshare\ncheck\nmove\nstep-backward\nfast-backward\nbackward\nplay\npause\nstop\nforward\nfast-forward\nstep-forward\neject\nchevron-left\nchevron-right\nplus-sign\nminus-sign\nremove-sign\nok-sign\nquestion-sign\ninfo-sign\nscreenshot\nremove-circle\nok-circle\nban-circle\narrow-left\narrow-right\narrow-up\narrow-down\nshare-alt\nresize-full\nresize-small\nplus\nminus\nasterisk\nexclamation-sign\ngift\nleaf\nfire\neye-open\neye-close\nwarning-sign\nplane\ncalendar\nrandom\ncomment\nmagnet\nchevron-up\nchevron-down\nretweet\nshopping-cart\nfolder-close\nfolder-open\nresize-vertical\nresize-horizontal\nhdd\nbullhorn\nbell\ncertificate\nthumbs-up\nthumbs-down\nhand-right\nhand-left\nhand-up\nhand-down\ncircle-arrow-right\ncircle-arrow-left\ncircle-arrow-up\ncircle-arrow-down\nglobe\nwrench\ntasks\nfilter\nbriefcase\nfullscreen",
|
||||
"permlevel": 0,
|
||||
|
|
@ -66,6 +67,7 @@
|
|||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Style",
|
||||
"length": 20,
|
||||
"no_copy": 0,
|
||||
"options": "\nPrimary\nInfo\nSuccess\nWarning\nDanger\nInverse",
|
||||
"permlevel": 0,
|
||||
|
|
@ -87,7 +89,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"modified": "2015-07-28 16:18:13.320514",
|
||||
"modified": "2015-10-02 07:39:20.222387",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Workflow",
|
||||
"name": "Workflow State",
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@
|
|||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"modified": "2013-12-20 19:21:55.000001",
|
||||
"modified": "2015-10-02 07:39:20.308052",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Workflow",
|
||||
"name": "Workflow Transition",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue