Merge branch 'master' into edge
This commit is contained in:
commit
c81f7616e1
7 changed files with 38 additions and 10 deletions
|
|
@ -41,7 +41,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||
cur_frm.perm = [[1,0,0]]
|
||||
|
||||
// make help heading
|
||||
webnotes.msgprint('<b>Cannot Edit DocType directly</b>: \
|
||||
msgprint('<b>Cannot Edit DocType directly</b>: \
|
||||
To edit DocType properties, \
|
||||
create / update <a href="#!List/Custom%20Field">Custom Field</a>, \
|
||||
<a href="#!List/Custom%20Script">Custom Script</a> \
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
test_records = [[{
|
||||
"doctype":"Profile",
|
||||
"email": "test@erpnext.com",
|
||||
"email": "test@example.com",
|
||||
"first_name": "_Test",
|
||||
"new_password": "testpassword"
|
||||
}],
|
||||
[{
|
||||
"doctype":"Profile",
|
||||
"email": "test1@erpnext.com",
|
||||
"email": "test1@example.com",
|
||||
"first_name": "_Test1",
|
||||
"new_password": "testpassword"
|
||||
}],
|
||||
[{
|
||||
"doctype":"Profile",
|
||||
"email": "test2@example.com",
|
||||
"first_name": "_Test2",
|
||||
"new_password": "testpassword"
|
||||
}]]
|
||||
|
|
@ -1075,7 +1075,7 @@ SelectField.prototype.make_input = function() {
|
|||
me.options_list = me.df.options || [""];
|
||||
else
|
||||
me.options_list = me.df.options?me.df.options.split('\n'):[''];
|
||||
|
||||
|
||||
// add options
|
||||
if(me.in_filter && me.options_list[0]!='') {
|
||||
me.options_list = add_lists([''], me.options_list);
|
||||
|
|
@ -1124,8 +1124,18 @@ SelectField.prototype.make_input = function() {
|
|||
if(me.input.options[i].value && inList(typeof(v)=='string'?v.split(","):v, me.input.options[i].value))
|
||||
me.input.options[i].selected = 1;
|
||||
}
|
||||
} else if(in_list(me.options_list, v)){
|
||||
me.input.value = v;
|
||||
} else {
|
||||
// use option's value if dict, else use string for comparison and setting
|
||||
for(var i in me.options_list) {
|
||||
var option = me.options_list[i];
|
||||
if(typeof(option)!=="string") {
|
||||
option = option.value;
|
||||
}
|
||||
if(option === v) {
|
||||
me.input.value = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,9 +135,9 @@ class Installer:
|
|||
|
||||
# userroles
|
||||
{'doctype':'UserRole', 'parent': 'Administrator', 'role': 'Administrator',
|
||||
'parenttype':'Profile', 'parentfield':'userroles'},
|
||||
'parenttype':'Profile', 'parentfield':'user_roles'},
|
||||
{'doctype':'UserRole', 'parent': 'Guest', 'role': 'Guest',
|
||||
'parenttype':'Profile', 'parentfield':'userroles'}
|
||||
'parenttype':'Profile', 'parentfield':'user_roles'}
|
||||
]
|
||||
|
||||
webnotes.conn.begin()
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class ModelWrapper:
|
|||
def no_permission_to(self, ptype):
|
||||
webnotes.msgprint(("%s (%s): " % (self.doc.name, _(self.doc.doctype))) + \
|
||||
_("No Permission to ") + ptype, raise_exception=True)
|
||||
|
||||
|
||||
# clone
|
||||
|
||||
def clone(source_wrapper):
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ class Profile:
|
|||
d['in_create'] = self.in_create
|
||||
|
||||
return d
|
||||
|
||||
|
||||
def get_user_fullname(user):
|
||||
fullname = webnotes.conn.sql("SELECT CONCAT_WS(' ', first_name, last_name) FROM `tabProfile` WHERE name=%s", user)
|
||||
return fullname and fullname[0][0] or ''
|
||||
|
|
@ -206,3 +206,12 @@ def get_system_managers():
|
|||
where ur.parent = p.name and ur.role="System Manager")""")
|
||||
|
||||
return [p[0] for p in system_managers]
|
||||
|
||||
def add_role(profile, role):
|
||||
profile_wrapper = webnotes.model_wrapper("Profile", profile)
|
||||
profile_wrapper.doclist.append({
|
||||
"doctype": "UserRole",
|
||||
"parentfield": "user_roles",
|
||||
"role": role
|
||||
})
|
||||
profile_wrapper.save()
|
||||
|
|
|
|||
|
|
@ -134,6 +134,9 @@ if __name__=="__main__":
|
|||
args = parser.parse_args()
|
||||
webnotes.print_messages = args.verbose
|
||||
|
||||
if not webnotes.conn:
|
||||
webnotes.connect()
|
||||
|
||||
if args.doctype:
|
||||
run_unittest(args.doctype[0])
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue