diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py
index 75fab1c9ea1..25e92aa5f91 100644
--- a/erpnext/home/__init__.py
+++ b/erpnext/home/__init__.py
@@ -20,36 +20,36 @@ from frappe import msgprint
feed_dict = {
# Project
- 'Project': ['[%(status)s]', '#000080'],
- 'Task': ['[%(status)s] %(subject)s', '#000080'],
-
+ 'Project': ['[%(status)s]', '#000080'],
+ 'Task': ['[%(status)s] %(subject)s', '#000080'],
+
# Sales
- 'Lead': ['%(lead_name)s', '#000080'],
- 'Quotation': ['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
- 'Sales Order': ['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
-
+ 'Lead': ['%(lead_name)s', '#000080'],
+ 'Quotation': ['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
+ 'Sales Order': ['[%(status)s] To %(customer_name)s worth %(currency)s %(grand_total_export)s', '#4169E1'],
+
# Purchase
- 'Supplier': ['%(supplier_name)s, %(supplier_type)s', '#6495ED'],
- 'Purchase Order': ['[%(status)s] %(name)s To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
-
+ 'Supplier': ['%(supplier_name)s, %(supplier_type)s', '#6495ED'],
+ 'Purchase Order': ['[%(status)s] %(name)s To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
+
# Stock
- 'Delivery Note': ['[%(status)s] To %(customer_name)s', '#4169E1'],
+ 'Delivery Note': ['[%(status)s] To %(customer_name)s', '#4169E1'],
'Purchase Receipt': ['[%(status)s] From %(supplier)s', '#4169E1'],
-
+
# Accounts
- 'Journal Voucher': ['[%(voucher_type)s] %(name)s', '#4169E1'],
- 'Purchase Invoice': ['To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
- 'Sales Invoice':['To %(customer_name)s for %(currency)s %(grand_total_export)s', '#4169E1'],
-
+ 'Journal Voucher': ['[%(voucher_type)s] %(name)s', '#4169E1'],
+ 'Purchase Invoice': ['To %(supplier_name)s for %(currency)s %(grand_total_import)s', '#4169E1'],
+ 'Sales Invoice': ['To %(customer_name)s for %(currency)s %(grand_total_export)s', '#4169E1'],
+
# HR
- 'Expense Claim': ['[%(approval_status)s] %(name)s by %(employee_name)s', '#4169E1'],
- 'Salary Slip': ['%(employee_name)s for %(month)s %(fiscal_year)s', '#4169E1'],
- 'Leave Transaction':['%(leave_type)s for %(employee)s', '#4169E1'],
-
+ 'Expense Claim': ['[%(approval_status)s] %(name)s by %(employee_name)s', '#4169E1'],
+ 'Salary Slip': ['%(employee_name)s for %(month)s %(fiscal_year)s', '#4169E1'],
+ 'Leave Transaction': ['%(leave_type)s for %(employee)s', '#4169E1'],
+
# Support
- 'Customer Issue': ['[%(status)s] %(description)s by %(customer_name)s', '#000080'],
- 'Maintenance Visit':['To %(customer_name)s', '#4169E1'],
- 'Support Ticket': ["[%(status)s] %(subject)s", '#000080'],
+ 'Customer Issue': ['[%(status)s] %(description)s by %(customer_name)s', '#000080'],
+ 'Maintenance Visit': ['To %(customer_name)s', '#4169E1'],
+ 'Support Ticket': ["[%(status)s] %(subject)s", '#000080'],
# Website
'Web Page': ['%(title)s', '#000080'],
@@ -59,7 +59,7 @@ feed_dict = {
def make_feed(feedtype, doctype, name, owner, subject, color):
"makes a new Feed record"
#msgprint(subject)
- from frappe.utils import get_fullname
+ from frappe.utils import get_fullname
if feedtype in ('Login', 'Comment', 'Assignment'):
# delete old login, comment feed
@@ -71,7 +71,7 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
where doc_type=%s and doc_name=%s
and ifnull(feed_type,'') != 'Comment'""", (doctype, name))
- f = frappe.get_doc('Feed')
+ f = frappe.new_doc('Feed')
f.owner = owner
f.feed_type = feedtype
f.doc_type = doctype
@@ -81,16 +81,15 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
f.full_name = get_fullname(owner)
f.save()
-def update_feed(bean, method=None):
+def update_feed(doc, method=None):
"adds a new feed"
- doc = bean.doc
if method in ['on_update', 'on_submit']:
subject, color = feed_dict.get(doc.doctype, [None, None])
if subject:
make_feed('', doc.doctype, doc.name, doc.owner, subject % doc.fields, color)
-def make_comment_feed(bean, method):
+def make_comment_feed(doc, method):
"""add comment to feed"""
- doc = bean.doc
make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by,
- '"' + doc.comment + '"', '#6B24B3')
\ No newline at end of file
+ '"' + doc.comment + '"', '#6B24B3')
+
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index 973b742a489..9cf20209091 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -18,7 +18,7 @@ def boot_session(bootinfo):
load_country_and_currency(bootinfo)
bootinfo['notification_settings'] = frappe.get_doc("Notification Control",
- "Notification Control").get_values()
+ "Notification Control")
# if no company, show a dialog box to create a new company
bootinfo["customer_count"] = frappe.db.sql("""select count(*) from tabCustomer""")[0][0]
diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py
index 448cbf0de3b..0fea0ea55b1 100644
--- a/erpnext/startup/event_handlers.py
+++ b/erpnext/startup/event_handlers.py
@@ -4,14 +4,14 @@
from __future__ import unicode_literals
import frappe
+from frappe.utils import nowtime
+from frappe.utils.user import get_user_fullname
from erpnext.home import make_feed
def on_session_creation(login_manager):
"""make feed"""
if frappe.session['user'] not in ('Guest'):
# create feed
- from frappe.utils import nowtime
- from frappe.utils.user import get_user_fullname
make_feed('Login', 'User', login_manager.user, login_manager.user,
'%s logged in at %s' % (get_user_fullname(login_manager.user), nowtime()),
login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D')
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 3dd406f2290..fc7f64eb6f0 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -257,7 +257,7 @@ def make_purchase_order_based_on_supplier(source_name, target_doc=None):
if target_doc:
if isinstance(target_doc, basestring):
import json
- target_doc = frappe.doclist(json.loads(target_doc))
+ target_doc = frappe.get_doc(json.loads(target_doc))
target_doc = target_doc.get({"parentfield": ["!=", "po_details"]})
material_requests, supplier_items = get_material_requests_based_on_supplier(source_name)