Merge pull request #6846 from KanchanChauhan/payroll-updates

Weekly, Fortnightly, Bimonthly and Monthly payroll frequency
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 2d1a24d..b54ba59 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.1.21'
+__version__ = '7.1.22'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index d6cf120..4e4ad78 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -296,4 +296,3 @@
 		si_doc.docstatus = 0
 		si_doc.flags.ignore_mandatory = True
 		si_doc.insert()
-		frappe.log_error(frappe.get_traceback())
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index bb19581..48d3e00 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -79,9 +79,9 @@
 			self.status = "Completed"
 
 	def set_dates(self):
-		if self.docstatus < 2:
-			start_date = min([d.from_time for d in self.time_logs])
-			end_date = max([d.to_time for d in self.time_logs])
+		if self.docstatus < 2 and self.time_logs:
+			start_date = min([getdate(d.from_time) for d in self.time_logs])
+			end_date = max([getdate(d.to_time) for d in self.time_logs])
 
 			if start_date and end_date:
 				self.start_date = getdate(start_date)
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 57e2c06..0caf1cd 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -43,7 +43,7 @@
 	get_party_item_code(args, item_doc, out)
 
 	if out.get("warehouse"):
-		out.update(get_bin_details_and_serial_nos(args.item_code, out.warehouse, args.qty, args.serial_no))	
+		out.update(get_bin_details(args.item_code, out.warehouse))	
 
 	if frappe.db.exists("Product Bundle", args.item_code):
 		valuation_rate = 0.0
diff --git a/erpnext/support/doctype/issue/issue.js b/erpnext/support/doctype/issue/issue.js
index 21ef5b8..2bee422 100644
--- a/erpnext/support/doctype/issue/issue.js
+++ b/erpnext/support/doctype/issue/issue.js
@@ -15,5 +15,21 @@
 				frm.save();
 			});
 		}
+	},
+
+	timeline_refresh: function(frm) {
+		// create button for "Add to Knowledge Base"
+		if(frappe.model.can_create('Help Article')) {
+			$('<button class="btn btn-xs btn-default btn-add-to-kb pull-right" style="margin-top: -2px">'+
+				__('Add to Knowledge Base') + '</button>')
+				.appendTo(frm.timeline.wrapper.find('.comment-header'))
+				.on('click', function() {
+					var content = $(this).parents('.timeline-item:first').find('.timeline-item-content').html();
+					var doc = frappe.model.get_new_doc('Help Article');
+					doc.title = frm.doc.subject;
+					doc.content = content;
+					frappe.set_route('Form', 'Help Article', doc.name);
+				});
+		}
 	}
 });