Merge pull request #7625 from neilLasrado/student-batch

Added Mark Assessment Result Button in assessment plan
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 20f5e54..d916789 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.2.17'
+__version__ = '7.2.18'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py
index 366d771..0a969ed 100644
--- a/erpnext/config/hr.py
+++ b/erpnext/config/hr.py
@@ -146,6 +146,11 @@
 					"name": "Appraisal Template",
 					"description": _("Template for performance appraisals.")
 				},
+				{
+					"type": "page",
+					"name": "team-updates",
+					"label": _("Team Updates")
+				},
 			]
 		},
 
@@ -166,7 +171,7 @@
 				},
 			]
 		},
-		
+
 		{
 			"label": _("Fleet Management"),
 			"items": [
@@ -180,7 +185,7 @@
 				},
 			]
 		},
-		
+
 
 		{
 			"label": _("Setup"),
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 032fd66..c489008 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -93,8 +93,10 @@
 			sle.voucher_type, sle.voucher_no)
 		sle.stock_value = flt(sle.qty_after_transaction) * flt(sle.valuation_rate)
 		sle.stock_value_difference = sle.stock_value
-		sle.doctype="Stock Ledger Entry"
-		frappe.get_doc(sle).db_update()
+		if sle.name:
+			frappe.db.sql(""" update `tabStock Ledger Entry` set stock_value = %(stock_value)s,
+				valuation_rate = %(valuation_rate)s, stock_value_difference = %(stock_value_difference)s 
+				where name = %(name)s""", (sle))
 
 	def validate_negative_stock(self, sle):
 		if sle.qty_after_transaction < 0 and sle.actual_qty < 0:
@@ -148,7 +150,7 @@
 
 	def get_stock_ledger_details(self):
 		stock_ledger = {}
-		for sle in frappe.db.sql("""select warehouse, stock_value_difference,
+		for sle in frappe.db.sql("""select name, warehouse, stock_value_difference,
 			voucher_detail_no, item_code, posting_date, posting_time, actual_qty, qty_after_transaction
 			from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s""",
 			(self.doctype, self.name), as_dict=True):
diff --git a/erpnext/hr/page/team_updates/__init__.py b/erpnext/hr/page/team_updates/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/page/team_updates/__init__.py
diff --git a/erpnext/hr/page/team_updates/team_update_row.html b/erpnext/hr/page/team_updates/team_update_row.html
new file mode 100644
index 0000000..c81a4cb
--- /dev/null
+++ b/erpnext/hr/page/team_updates/team_update_row.html
@@ -0,0 +1,15 @@
+<div class="row activity-row" data-creation="{%= creation.split(" ")[0] + " 00:00:00" %}">
+	<div class="col-xs-3 text-right activity-date"><span class="{%= date_class %}">
+		{%= date_sep || "" %}</span></div>
+	<div class="col-xs-9 activity-message"
+		title="{%= by %} / {%= dateutil.str_to_user(creation) %}">
+		<div class="row">
+			<div class="col-xs-2 col-sm-1">
+				{{ avatar }}
+			</div>
+			<div class="col-xs-10 col-sm-11 small" style="padding-top: 5px;">
+				{{ content }}
+			</div>
+		</div>
+	</div>
+</div>
diff --git a/erpnext/hr/page/team_updates/team_updates.css b/erpnext/hr/page/team_updates/team_updates.css
new file mode 100644
index 0000000..7f6a40a
--- /dev/null
+++ b/erpnext/hr/page/team_updates/team_updates.css
@@ -0,0 +1,41 @@
+.date-indicator {
+    background:none;
+    font-size:12px;
+    vertical-align:middle;
+    font-weight:bold;
+    color:#6c7680;
+}
+.date-indicator::after {
+    margin:0 -4px 0 12px;
+    content:'';
+    display:inline-block;
+    height:8px;
+    width:8px;
+    border-radius:8px;
+	background: #d1d8dd;
+}
+
+.date-indicator.blue {
+	color: #5e64ff;
+}
+
+.date-indicator.blue::after {
+	background: #5e64ff;
+}
+
+.activity-message {
+	border-left: 1px solid #d1d8dd;
+	padding: 15px;
+	padding-right: 30px;
+}
+
+.activity-date {
+	padding: 15px;
+	padding-right: 0px;
+	z-index: 1;
+}
+
+.for-more {
+	border-top: 1px solid #d1d8dd;
+	padding: 10px;
+}
diff --git a/erpnext/hr/page/team_updates/team_updates.js b/erpnext/hr/page/team_updates/team_updates.js
new file mode 100644
index 0000000..e701b5f
--- /dev/null
+++ b/erpnext/hr/page/team_updates/team_updates.js
@@ -0,0 +1,79 @@
+frappe.pages['team-updates'].on_page_load = function(wrapper) {
+	var page = frappe.ui.make_app_page({
+		parent: wrapper,
+		title: __('Team Updates'),
+		single_column: true
+	});
+
+	frappe.team_updates.make(page);
+	frappe.team_updates.run();
+
+	if(frappe.model.can_read('Daily Work Summary Settings')) {
+		page.add_menu_item(__('Daily Work Summary Settings'), function() {
+			frappe.set_route('Form', 'Daily Work Summary Settings');
+		});
+	}
+}
+
+frappe.team_updates = {
+	start: 0,
+	make: function(page) {
+		var me = frappe.team_updates;
+		me.page = page;
+		me.body = $('<div></div>').appendTo(me.page.main);
+		me.more = $('<div class="for-more"><button class="btn btn-sm btn-default btn-more">'
+			+ __("More") + '</button></div>').appendTo(me.page.main)
+			.find('.btn-more').on('click', function() {
+				me.start += 40;
+				me.run();
+			});
+	},
+	run: function() {
+		var me = frappe.team_updates;
+		frappe.call({
+			method: 'erpnext.hr.page.team_updates.team_updates.get_data',
+			args: {
+				start: me.start
+			},
+			callback: function(r) {
+				if(r.message) {
+					r.message.forEach(function(d) {
+						me.add_row(d);
+					});
+				} else {
+					frappe.show_alert({message:__('No more updates'), indicator:'darkgrey'});
+					me.more.parent().addClass('hidden');
+				}
+			}
+		});
+	},
+	add_row: function(data) {
+		var me = frappe.team_updates;
+
+		data.by = frappe.user.full_name(data.sender);
+		data.avatar = frappe.avatar(data.sender);
+		data.when = comment_when(data.creation);
+
+		var date = dateutil.str_to_obj(data.creation);
+		var last = me.last_feed_date;
+
+		if((last && dateutil.obj_to_str(last) != dateutil.obj_to_str(date)) || (!last)) {
+			var diff = dateutil.get_day_diff(dateutil.get_today(), dateutil.obj_to_str(date));
+			if(diff < 1) {
+				pdate = 'Today';
+			} else if(diff < 2) {
+				pdate = 'Yesterday';
+			} else {
+				pdate = dateutil.global_date_format(date);
+			}
+			data.date_sep = pdate;
+			data.date_class = pdate=='Today' ? "date-indicator blue" : "date-indicator";
+		} else {
+			data.date_sep = null;
+			data.date_class = "";
+		}
+		me.last_feed_date = date;
+
+		$(frappe.render_template('team_update_row', data)).appendTo(me.body)
+	}
+}
\ No newline at end of file
diff --git a/erpnext/hr/page/team_updates/team_updates.json b/erpnext/hr/page/team_updates/team_updates.json
new file mode 100644
index 0000000..167c67f
--- /dev/null
+++ b/erpnext/hr/page/team_updates/team_updates.json
@@ -0,0 +1,25 @@
+{
+ "content": null, 
+ "creation": "2017-01-31 11:02:31.614045", 
+ "docstatus": 0, 
+ "doctype": "Page", 
+ "idx": 0, 
+ "modified": "2017-01-31 11:25:01.983200", 
+ "modified_by": "Administrator", 
+ "module": "HR", 
+ "name": "team-updates", 
+ "owner": "Administrator", 
+ "page_name": "team-updates", 
+ "roles": [
+  {
+   "role": "Employee"
+  }, 
+  {
+   "role": "System Manager"
+  }
+ ], 
+ "script": null, 
+ "standard": "Yes", 
+ "style": null, 
+ "title": "Team Updates"
+}
\ No newline at end of file
diff --git a/erpnext/hr/page/team_updates/team_updates.py b/erpnext/hr/page/team_updates/team_updates.py
new file mode 100644
index 0000000..5b90f6f
--- /dev/null
+++ b/erpnext/hr/page/team_updates/team_updates.py
@@ -0,0 +1,21 @@
+from __future__ import unicode_literals
+
+import frappe
+from email_reply_parser import EmailReplyParser
+from markdown2 import markdown
+
+@frappe.whitelist()
+def get_data(start=0):
+	#frappe.only_for('Employee', 'System Manager')
+	data = frappe.get_all('Communication',
+		fields=('content', 'text_content', 'sender', 'creation'),
+		filters=dict(reference_doctype='Daily Work Summary'),
+		order_by='creation desc', limit=40, start=start)
+
+	for d in data:
+		d.sender_name = frappe.db.get_value("Employee", {"user_id": d.sender},
+			"employee_name") or d.sender
+		if d.text_content:
+			d.content = markdown(EmailReplyParser.parse_reply(d.text_content))
+
+	return data
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 316d35b..5748a93 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -2713,7 +2713,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2017-01-18 17:43:20.262925", 
+ "modified": "2017-01-30 17:25:46.211995", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item", 
@@ -2729,7 +2729,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 1, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -2750,7 +2749,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -2771,7 +2769,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -2792,7 +2789,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -2813,7 +2809,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -2834,7 +2829,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -2855,7 +2849,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -2876,7 +2869,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -2895,5 +2887,6 @@
  "sort_field": "idx desc, modified desc", 
  "sort_order": "DESC", 
  "title_field": "item_name", 
+ "track_changes": 1, 
  "track_seen": 0
 }
\ No newline at end of file