Merge pull request #4466 from rmehta/task-notification-on-overdue
[enhancement] task status will be set to overdue when it crosses expected end date
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js
index 9ed5c76..f2e5a9e 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.js
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.js
@@ -32,7 +32,7 @@
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
if (doc.employee && doc.fiscal_year && doc.month) {
- return $c_obj(doc, 'get_leave_details',doc.leave_without_pay,function(r, rt) {
+ return $c_obj(doc, 'get_leave_details', {"lwp": doc.leave_without_pay}, function(r, rt) {
var doc = locals[dt][dn];
cur_frm.refresh();
calculate_all(doc, dt, dn);
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 818c95e..671fbb8 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -90,14 +90,14 @@
start_date = joining_date
elif joining_date > month['month_end_date']:
return
-
+
+ end_date = month['month_end_date']
if relieving_date:
if relieving_date > start_date and relieving_date < month['month_end_date']:
end_date = relieving_date
elif relieving_date < month['month_start_date']:
- frappe.throw(_("Employee relieved on {0} must be set as 'Left'").format(relieving_date))
- else:
- end_date = month['month_end_date']
+ frappe.throw(_("Employee relieved on {0} must be set as 'Left'")
+ .format(relieving_date))
payment_days = date_diff(end_date, start_date) + 1
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index d712cc9..55295f4 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -10,6 +10,9 @@
frm.fields_dict["attributes"].grid.set_column_disp("attribute_value", true);
}
+ // should never check Private
+ frm.fields_dict["website_image"].df.is_private = 0;
+
},
refresh: function(frm) {
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index dfd281a..6bdafcf 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -47,8 +47,6 @@
if not self.stock_uom:
msgprint(_("Please enter default Unit of Measure"), raise_exception=1)
- if self.image and not self.website_image:
- self.website_image = self.image
self.check_warehouse_is_set_for_stock_item()
self.validate_uom()
@@ -68,6 +66,7 @@
self.validate_has_variants()
self.validate_attributes()
self.validate_variant_attributes()
+ self.validate_website_image()
self.make_thumbnail()
if not self.get("__islocal"):
@@ -83,6 +82,29 @@
self.update_variants()
self.update_template_item()
+ def validate_website_image(self):
+ """Validate if the website image is a public file"""
+ auto_set_website_image = False
+ if not self.website_image and self.image:
+ auto_set_website_image = True
+ self.website_image = self.image
+
+ file = frappe.db.get_value("File", filters={
+ "file_url": self.website_image,
+ "attached_to_doctype": self.doctype,
+ "attached_to_name": self.name
+ }, fieldname=["name", "is_private"], as_dict=True)
+
+ if not file:
+ self.website_image = None
+ if not auto_set_website_image:
+ frappe.msgprint(_("Website Image {0} attached to Item {1} cannot be found").format(self.website_image, self.name))
+
+ elif file.is_private:
+ self.website_image = None
+ if not auto_set_website_image:
+ frappe.msgprint(_("Website Image should be a public file or website URL"))
+
def make_thumbnail(self):
"""Make a thumbnail of `website_image`"""
import requests.exceptions
@@ -383,7 +405,7 @@
for d in self.get("reorder_levels"):
if d.warehouse_reorder_level and not d.warehouse_reorder_qty:
frappe.throw(_("Row #{0}: Please set reorder quantity").format(d.idx))
-
+
def validate_warehouse_for_reorder(self):
warehouse = []