Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
44bba97dc9
@ -42,13 +42,48 @@ pscript.myc_show_erpnext_message = function() {
|
|||||||
// Add user dialog and server call
|
// Add user dialog and server call
|
||||||
//
|
//
|
||||||
pscript.myc_add_user = function() {
|
pscript.myc_add_user = function() {
|
||||||
|
var fields = [{
|
||||||
|
fieldtype: 'Data',
|
||||||
|
fieldname: 'user',
|
||||||
|
reqd: 1,
|
||||||
|
label: 'Email Id of the user to add'
|
||||||
|
}];
|
||||||
|
console.log(pscript.is_erpnext_saas);
|
||||||
|
|
||||||
|
if(pscript.is_erpnext_saas==0) {
|
||||||
|
fields = fields.concat([
|
||||||
|
{
|
||||||
|
fieldtype: 'Data',
|
||||||
|
fieldname: 'first_name',
|
||||||
|
reqd: 1,
|
||||||
|
label: 'First Name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldtype: 'Data',
|
||||||
|
fieldname: 'last_name',
|
||||||
|
reqd: 1,
|
||||||
|
label: 'Last Name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldtype: 'Data',
|
||||||
|
fieldname: 'password',
|
||||||
|
reqd: 1,
|
||||||
|
label: 'Password'
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fields.push({
|
||||||
|
fieldtype: 'Button',
|
||||||
|
label: 'Add',
|
||||||
|
fieldname: 'add'
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(fields);
|
||||||
|
|
||||||
var d = new wn.widgets.Dialog({
|
var d = new wn.widgets.Dialog({
|
||||||
title: 'Add User',
|
title: 'Add User',
|
||||||
width: 400,
|
width: 400,
|
||||||
fields: [
|
fields: fields
|
||||||
{fieldtype:'Data', fieldname:'user',reqd:1,label:'Email Id of the user to add'},
|
|
||||||
{fieldtype:'Button', label:'Add', fieldname:'add'}
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
d.make();
|
d.make();
|
||||||
d.fields_dict.add.input.onclick = function() {
|
d.fields_dict.add.input.onclick = function() {
|
||||||
|
@ -57,14 +57,15 @@ def add_user(args):
|
|||||||
from server_tools.gateway_utils import add_user_gateway
|
from server_tools.gateway_utils import add_user_gateway
|
||||||
add_user_gateway(args['user'])
|
add_user_gateway(args['user'])
|
||||||
|
|
||||||
add_profile(args['user'])
|
add_profile(args)
|
||||||
|
|
||||||
#
|
#
|
||||||
# add profile record
|
# add profile record
|
||||||
#
|
#
|
||||||
def add_profile(email):
|
def add_profile(args):
|
||||||
from webnotes.utils import validate_email_add
|
from webnotes.utils import validate_email_add
|
||||||
from webnotes.model.doc import Document
|
from webnotes.model.doc import Document
|
||||||
|
email = args['user']
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -83,10 +84,18 @@ def add_profile(email):
|
|||||||
pr = Document('Profile')
|
pr = Document('Profile')
|
||||||
pr.name = email
|
pr.name = email
|
||||||
pr.email = email
|
pr.email = email
|
||||||
pr.enabled=1
|
pr.first_name = args.get('first_name')
|
||||||
pr.user_type='System User'
|
pr.last_name = args.get('last_name')
|
||||||
|
pr.enabled = 1
|
||||||
|
pr.user_type = 'System User'
|
||||||
pr.save(1)
|
pr.save(1)
|
||||||
|
|
||||||
|
if args.get('password'):
|
||||||
|
sql("""
|
||||||
|
UPDATE tabProfile
|
||||||
|
SET password = PASSWORD(%s)
|
||||||
|
WHERE name = %s""", (args.get('password'), email))
|
||||||
|
|
||||||
#
|
#
|
||||||
# post comment
|
# post comment
|
||||||
#
|
#
|
||||||
|
@ -386,7 +386,7 @@ class DocType:
|
|||||||
'event': 'setup.doctype.email_digest.email_digest.send'
|
'event': 'setup.doctype.email_digest.email_digest.send'
|
||||||
}
|
}
|
||||||
from webnotes.utils.scheduler import Scheduler
|
from webnotes.utils.scheduler import Scheduler
|
||||||
print "before scheduler"
|
#print "before scheduler"
|
||||||
sch = Scheduler()
|
sch = Scheduler()
|
||||||
sch.connect()
|
sch.connect()
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ class DocType:
|
|||||||
else:
|
else:
|
||||||
# delete scheduler entry
|
# delete scheduler entry
|
||||||
sch.clear(args['db_name'], args['event'])
|
sch.clear(args['db_name'], args['event'])
|
||||||
print "after on update"
|
#print "after on update"
|
||||||
|
|
||||||
|
|
||||||
def get_next_sending(self):
|
def get_next_sending(self):
|
||||||
|
@ -14,7 +14,8 @@ class DocType:
|
|||||||
# on update
|
# on update
|
||||||
#
|
#
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if self.doc.file_list and self.doc.set_from_attachment:
|
from webnotes.utils import cint
|
||||||
|
if self.doc.file_list and cint(self.doc.set_from_attachment):
|
||||||
self.set_html_from_image()
|
self.set_html_from_image()
|
||||||
|
|
||||||
# update control panel - so it loads new letter directly
|
# update control panel - so it loads new letter directly
|
||||||
|
Loading…
x
Reference in New Issue
Block a user