frappe/frappe#478 fixes
This commit is contained in:
parent
9f266a72ee
commit
efa987dfb1
5 changed files with 10 additions and 4 deletions
|
|
@ -212,6 +212,7 @@ def set_user(username):
|
|||
from frappe.utils.user import User
|
||||
local.session.user = username
|
||||
local.session.sid = username
|
||||
local.cache = {}
|
||||
local.session.data = {}
|
||||
local.user = User(username)
|
||||
local.restrictions = None
|
||||
|
|
|
|||
|
|
@ -66,12 +66,12 @@ def post(arg=None):
|
|||
import json
|
||||
arg = json.loads(arg)
|
||||
|
||||
d = frappe.new_doc('Comment')
|
||||
d = frappe.new_doc('Comment')
|
||||
d.parenttype = arg.get("parenttype")
|
||||
d.comment = arg['txt']
|
||||
d.comment_docname = arg['contact']
|
||||
d.comment_doctype = 'Message'
|
||||
d.save()
|
||||
d.insert(ignore_permissions=True)
|
||||
|
||||
delete_notification_count_for("Messages")
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@ from frappe.model.document import Document
|
|||
class EmptyTableError(frappe.ValidationError): pass
|
||||
|
||||
class DocListController(Document):
|
||||
def __init__(self, arg1, arg2=None):
|
||||
super(DocListController, self).__init__(arg1, arg2)
|
||||
if hasattr(self, "setup"):
|
||||
self.setup()
|
||||
|
||||
def validate_value(self, fieldname, condition, val2, doc=None, raise_exception=None):
|
||||
"""check that value of fieldname should be 'condition' val2
|
||||
else throw exception"""
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ def has_unrestricted_access(doc, verbose=True):
|
|||
|
||||
def has_controller_permissions(doc):
|
||||
if doc.get("__islocal"):
|
||||
doc = frappe.get_doc([doc])
|
||||
doc = frappe.get_doc(doc)
|
||||
else:
|
||||
doc = frappe.get_doc(doc.doctype, doc.name)
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ def make_test_objects(doctype, test_records, verbose=None):
|
|||
records = []
|
||||
|
||||
for doc in test_records:
|
||||
if not hasattr(doc, "doctype"):
|
||||
if not doc.get("doctype"):
|
||||
doc["doctype"] = doctype
|
||||
|
||||
d = frappe.copy_doc(doc)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue