Merge branch 'edge' of github.com:webnotes/wnframework into edge

This commit is contained in:
Rushabh Mehta 2013-02-06 09:00:13 +01:00
commit 581220d1d1
6 changed files with 67 additions and 38 deletions

View file

@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:04",
"docstatus": 0,
"modified": "2013-01-28 15:29:20",
"modified": "2013-02-06 11:30:43",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -14,7 +14,7 @@
"allow_rename": 1,
"description": "Profile Represents a User in the system.",
"doctype": "DocType",
"document_type": "System",
"document_type": "Master",
"hide_heading": 0,
"hide_toolbar": 0,
"issingle": 0,

View file

@ -1,47 +1,48 @@
[
{
"owner": "Administrator",
"creation": "2013-01-10 16:34:04",
"docstatus": 0,
"creation": "2012-07-13 16:53:46",
"modified": "2013-02-06 11:43:05",
"modified_by": "Administrator",
"modified": "2013-01-02 12:46:21"
"owner": "Administrator"
},
{
"istable": 1,
"allow_print": 0,
"module": "Core",
"autoname": "UR.#####",
"read_only": 0,
"allow_copy": 0,
"allow_email": 0,
"hide_heading": 0,
"issingle": 0,
"name": "__common__",
"allow_print": 0,
"autoname": "UR.#####",
"doctype": "DocType",
"document_type": "Master",
"hide_heading": 0,
"hide_toolbar": 0,
"allow_copy": 0
"issingle": 0,
"istable": 1,
"module": "Core",
"name": "__common__",
"read_only": 0
},
{
"parent": "UserRole",
"print_width": "200px",
"oldfieldtype": "Link",
"doctype": "DocField",
"oldfieldname": "role",
"reqd": 0,
"name": "__common__",
"label": "Role",
"width": "200px",
"parenttype": "DocType",
"options": "Role",
"fieldname": "role",
"fieldtype": "Link",
"search_index": 0,
"hidden": 0,
"label": "Role",
"name": "__common__",
"oldfieldname": "role",
"oldfieldtype": "Link",
"options": "Role",
"parent": "UserRole",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0,
"parentfield": "fields"
"print_width": "200px",
"reqd": 0,
"search_index": 0,
"width": "200px"
},
{
"name": "UserRole",
"doctype": "DocType"
"doctype": "DocType",
"name": "UserRole"
},
{
"doctype": "DocField"

View file

@ -19,7 +19,7 @@ doctype_dl = None
@webnotes.whitelist()
def get_doctypes():
return [r[0] for r in webnotes.conn.sql("""select name from `tabDocType`
where document_type = 'Master'""")]
where document_type = 'Master'""")]
@webnotes.whitelist()
def get_doctype_options():

View file

@ -42,18 +42,31 @@ def insert(doclist):
@webnotes.whitelist()
def save(doclist):
"""insert or update from form query"""
if isinstance(doclist, basestring):
doclist = json.loads(doclist)
if not webnotes.has_permission(doclist[0]["doctype"], "write"):
webnotes.msgprint("No Write Permission", raise_exception=True)
doclistobj = webnotes.model_wrapper(doclist)
doclistobj.save()
return [d.fields for d in doclist]
@webnotes.whitelist()
def submit(doclist):
if isinstance(doclist, basestring):
doclist = json.loads(doclist)
doclistobj = webnotes.model_wrapper(doclist)
doclistobj.submit()
return [d.fields for d in doclist]
@webnotes.whitelist()
def cancel(doctype, name):
wrapper = webnotes.model_wrapper(doctype, name)
wrapper.cancel()
return [d.fields for d in wrapper.doclist]
@webnotes.whitelist()
def set_default(key, value, parent=None):
"""set a user default value"""

View file

@ -106,13 +106,14 @@ class IncomingMail:
return l and l[0] or None
class POP3Mailbox:
def __init__(self):
self.setup()
def __init__(self, args=None):
self.setup(args)
self.get_messages()
def setup(self):
def setup(self, args=None):
# overrride
self.settings = webnotes._dict()
import webnotes
self.settings = args or webnotes._dict()
def check_mails(self):
# overrride

View file

@ -50,7 +50,7 @@ def update(doclist):
"cmd": "webnotes.client.save",
"doclist": json.dumps(doclist)
})
def delete(doctype, name):
return post_request({
"cmd": "webnotes.model.delete_doc",
@ -58,6 +58,20 @@ def delete(doctype, name):
"name": name
})
def submit(doclist):
return post_request({
"cmd": "webnotes.client.submit",
"doclist": json.dumps(doclist)
})
def cancel(doctype, name):
return post_request({
"cmd": "webnotes.client.cancel",
"doctype": doctype,
"name": name
})
def get_doc(doctype, name=None, filters=None):
params = {
"cmd": "webnotes.client.get",