[minor] formatter for item and employee

This commit is contained in:
Rushabh Mehta 2016-07-26 17:57:42 +05:30
parent 69e0441041
commit 180e43585f
2 changed files with 20 additions and 1 deletions

View File

@ -179,6 +179,22 @@ erpnext.utils.map_current_doc = function(opts) {
} }
} }
frappe.form.link_formatters['Item'] = function(value, doc) {
if(doc.item_name && doc.item_name !== value) {
return value + ': ' + doc.item_name;
} else {
return value;
}
}
frappe.form.link_formatters['Employee'] = function(value, doc) {
if(doc.employee_name && doc.employee_name !== value) {
return value + ': ' + doc.employee_name;
} else {
return value;
}
}
// add description on posting time // add description on posting time
$(document).on('app_ready', function() { $(document).on('app_ready', function() {
if(!frappe.datetime.is_timezone_same()) { if(!frappe.datetime.is_timezone_same()) {

View File

@ -120,7 +120,10 @@ class Item(WebsiteGenerator):
'''set opening stock''' '''set opening stock'''
if not self.is_stock_item or self.has_serial_no or self.has_batch_no: if not self.is_stock_item or self.has_serial_no or self.has_batch_no:
return return
if not self.valuation_rate and self.standard_rate:
self.valuation_rate = self.standard_rate
if not self.valuation_rate: if not self.valuation_rate:
frappe.throw(_("Valuation Rate is mandatory if Opening Stock entered")) frappe.throw(_("Valuation Rate is mandatory if Opening Stock entered"))