@@ -1,2 +1,2 @@ | |||||
from __future__ import unicode_literals | from __future__ import unicode_literals | ||||
__version__ = "6.4.6" | |||||
__version__ = "6.4.7" |
@@ -7,4 +7,7 @@ import frappe | |||||
from frappe.model.document import Document | from frappe.model.document import Document | ||||
class Role(Document): | class Role(Document): | ||||
pass | |||||
def after_insert(self): | |||||
# Add role to Administrator | |||||
if frappe.flags.in_install != "frappe": | |||||
frappe.get_doc("User", "Administrator").add_roles(self.name) |
@@ -41,7 +41,7 @@ def upload(rows = None, submit_after_import=None, ignore_encoding_errors=False, | |||||
max_rows = 5000 | max_rows = 5000 | ||||
if not data: | if not data: | ||||
frappe.throw(_("No data found")) | frappe.throw(_("No data found")) | ||||
elif len(data) > max_rows: | |||||
elif not via_console and len(data) > max_rows: | |||||
frappe.throw(_("Only allowed {0} rows in one import").format(max_rows)) | frappe.throw(_("Only allowed {0} rows in one import").format(max_rows)) | ||||
def get_start_row(): | def get_start_row(): | ||||
@@ -46,7 +46,8 @@ class CustomizeForm(Document): | |||||
'depends_on': 'Data', | 'depends_on': 'Data', | ||||
'description': 'Text', | 'description': 'Text', | ||||
'default': 'Text', | 'default': 'Text', | ||||
'precision': 'Select' | |||||
'precision': 'Select', | |||||
'read_only': 'Check' | |||||
} | } | ||||
allowed_fieldtype_change = (('Currency', 'Float', 'Percent'), ('Small Text', 'Data'), | allowed_fieldtype_change = (('Currency', 'Float', 'Percent'), ('Small Text', 'Data'), | ||||
@@ -140,6 +141,12 @@ class CustomizeForm(Document): | |||||
elif property == "unique": | elif property == "unique": | ||||
update_db = True | update_db = True | ||||
elif (property == "read_only" and cint(df.get("read_only"))==0 | |||||
and frappe.db.get_value("DocField", {"parent": self.doc_type, "fieldname": df.fieldname}, "read_only")==1): | |||||
# if docfield has read_only checked and user is trying to make it editable, don't allow it | |||||
frappe.msgprint(_("You cannot unset 'Read Only' for field {0}").format(df.label)) | |||||
continue | |||||
self.make_property_setter(property=property, value=df.get(property), | self.make_property_setter(property=property, value=df.get(property), | ||||
property_type=self.docfield_properties[property], fieldname=df.fieldname) | property_type=self.docfield_properties[property], fieldname=df.fieldname) | ||||
@@ -334,6 +334,28 @@ | |||||
"unique": 0, | "unique": 0, | ||||
"width": "50px" | "width": "50px" | ||||
}, | }, | ||||
{ | |||||
"allow_on_submit": 0, | |||||
"bold": 0, | |||||
"collapsible": 0, | |||||
"fieldname": "read_only", | |||||
"fieldtype": "Check", | |||||
"hidden": 0, | |||||
"ignore_user_permissions": 0, | |||||
"in_filter": 0, | |||||
"in_list_view": 0, | |||||
"label": "Read Only", | |||||
"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, | "allow_on_submit": 0, | ||||
"bold": 0, | "bold": 0, | ||||
@@ -687,7 +709,7 @@ | |||||
"is_submittable": 0, | "is_submittable": 0, | ||||
"issingle": 0, | "issingle": 0, | ||||
"istable": 1, | "istable": 1, | ||||
"modified": "2015-09-04 02:49:57.129449", | |||||
"modified": "2015-10-01 07:59:15.490247", | |||||
"modified_by": "Administrator", | "modified_by": "Administrator", | ||||
"module": "Custom", | "module": "Custom", | ||||
"name": "Customize Form Field", | "name": "Customize Form Field", | ||||
@@ -26,7 +26,7 @@ to ERPNext. | |||||
""" | """ | ||||
app_icon = "octicon octicon-circuit-board" | app_icon = "octicon octicon-circuit-board" | ||||
app_version = "6.4.6" | |||||
app_version = "6.4.7" | |||||
app_color = "orange" | app_color = "orange" | ||||
github_link = "https://github.com/frappe/frappe" | github_link = "https://github.com/frappe/frappe" | ||||
@@ -319,8 +319,10 @@ def trim_tables(): | |||||
doctype = doctype.name | doctype = doctype.name | ||||
columns = frappe.db.get_table_columns(doctype) | columns = frappe.db.get_table_columns(doctype) | ||||
fields = [df.fieldname for df in frappe.get_meta(doctype).fields if df.fieldtype not in no_value_fields] | fields = [df.fieldname for df in frappe.get_meta(doctype).fields if df.fieldtype not in no_value_fields] | ||||
columns_to_remove = [f for f in list(set(columns) - set(fields)) if f not in ignore_fields] | |||||
columns_to_remove = [f for f in list(set(columns) - set(fields)) if f not in ignore_fields | |||||
and not f.startswith("_")] | |||||
if columns_to_remove: | if columns_to_remove: | ||||
print doctype, "columns removed:", columns_to_remove | |||||
columns_to_remove = ", ".join(["drop `{0}`".format(c) for c in columns_to_remove]) | columns_to_remove = ", ".join(["drop `{0}`".format(c) for c in columns_to_remove]) | ||||
query = """alter table `tab{doctype}` {columns}""".format( | query = """alter table `tab{doctype}` {columns}""".format( | ||||
doctype=doctype, columns=columns_to_remove) | doctype=doctype, columns=columns_to_remove) | ||||
@@ -93,3 +93,4 @@ frappe.patches.v6_0.fix_ghana_currency | |||||
frappe.patches.v6_2.ignore_user_permissions_if_missing | frappe.patches.v6_2.ignore_user_permissions_if_missing | ||||
execute:frappe.db.sql("delete from tabSessions where user is null") | execute:frappe.db.sql("delete from tabSessions where user is null") | ||||
frappe.patches.v6_2.rename_backup_manager | frappe.patches.v6_2.rename_backup_manager | ||||
execute:frappe.delete_doc("DocType", "Backup Manager") |
@@ -379,6 +379,9 @@ body { | |||||
position: relative; | position: relative; | ||||
padding-right: 10px; | padding-right: 10px; | ||||
} | } | ||||
.doclist-row .list-id { | |||||
font-weight: normal; | |||||
} | |||||
.doclist-row .list-row-id { | .doclist-row .list-row-id { | ||||
left: 18px; | left: 18px; | ||||
text-align: left; | text-align: left; | ||||
@@ -61,6 +61,15 @@ frappe.Application = Class.extend({ | |||||
// ask to allow notifications | // ask to allow notifications | ||||
frappe.utils.if_notify_permitted(); | frappe.utils.if_notify_permitted(); | ||||
// listen to csrf_update | |||||
frappe.realtime.on("csrf_generated", function(data) { | |||||
// handles the case when a user logs in again from another tab | |||||
// and it leads to invalid request in the current tab | |||||
if (data.csrf_token && data.sid===frappe.get_cookie("sid")) { | |||||
frappe.csrf_token = data.csrf_token; | |||||
} | |||||
}); | |||||
}, | }, | ||||
load_bootinfo: function() { | load_bootinfo: function() { | ||||
@@ -25,11 +25,14 @@ | |||||
{% for (var i=0, l= data.length; i < l; i++) { | {% for (var i=0, l= data.length; i < l; i++) { | ||||
var row = data[i]; %} | var row = data[i]; %} | ||||
<tr> | <tr> | ||||
{% for(var c=0; c < columns_length; c++) { var col = columns[c]; %} | |||||
{% for(var c=0; c < columns_length; c++) { var col = columns[c];%} | |||||
{% if(col.name && col._id !== "_check") { %} | {% if(col.name && col._id !== "_check") { %} | ||||
<td>{%= col.formatter | |||||
? col.formatter(i, c, row[col.id], col, row, true) | |||||
: row[col.id] %}</td> | |||||
{% var value = col.fieldname ? row[col.fieldname] : row[col.id]; %} | |||||
<td>{%= col.formatter | |||||
? col.formatter(i, c, value, col, row, true) | |||||
: value %}</td> | |||||
{% } %} | {% } %} | ||||
{% } %} | {% } %} | ||||
</tr> | </tr> | ||||
@@ -311,6 +311,10 @@ | |||||
position: relative; | position: relative; | ||||
padding-right: 10px; | padding-right: 10px; | ||||
.list-id { | |||||
font-weight: normal; | |||||
} | |||||
.list-row-id { | .list-row-id { | ||||
left: 18px; | left: 18px; | ||||
text-align: left; | text-align: left; | ||||
@@ -141,6 +141,13 @@ def generate_csrf_token(): | |||||
frappe.local.session.data.csrf_token = frappe.generate_hash() | frappe.local.session.data.csrf_token = frappe.generate_hash() | ||||
frappe.local.session_obj.update(force=True) | frappe.local.session_obj.update(force=True) | ||||
# send sid and csrf token to the user | |||||
# handles the case when a user logs in again from another tab | |||||
# and it leads to invalid request in the current tab | |||||
frappe.publish_realtime(event="csrf_generated", | |||||
message={"sid": frappe.local.session.sid, "csrf_token": frappe.local.session.data.csrf_token}, | |||||
user=frappe.session.user) | |||||
class Session: | class Session: | ||||
def __init__(self, user, resume=False, full_name=None, user_type=None): | def __init__(self, user, resume=False, full_name=None, user_type=None): | ||||
self.sid = cstr(frappe.form_dict.get('sid') or | self.sid = cstr(frappe.form_dict.get('sid') or | ||||
@@ -1,6 +1,6 @@ | |||||
from setuptools import setup, find_packages | from setuptools import setup, find_packages | ||||
version = "6.4.6" | |||||
version = "6.4.7" | |||||
with open("requirements.txt", "r") as f: | with open("requirements.txt", "r") as f: | ||||
install_requires = f.readlines() | install_requires = f.readlines() | ||||