[minor] set applicant name automatically
This commit is contained in:
@@ -3,16 +3,18 @@
|
|||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "JA-.######",
|
"autoname": "JA-.######",
|
||||||
|
"beta": 0,
|
||||||
"creation": "2013-01-29 19:25:37",
|
"creation": "2013-01-29 19:25:37",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"description": "Applicant for a Job",
|
"description": "Applicant for a Job",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "Document",
|
"document_type": "Document",
|
||||||
|
"editable_grid": 0,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 1,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"fieldname": "applicant_name",
|
"fieldname": "applicant_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
@@ -29,14 +31,14 @@
|
|||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 1,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"fieldname": "email_id",
|
"fieldname": "email_id",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
@@ -54,7 +56,7 @@
|
|||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
@@ -212,13 +214,14 @@
|
|||||||
"hide_toolbar": 0,
|
"hide_toolbar": 0,
|
||||||
"icon": "icon-user",
|
"icon": "icon-user",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
|
"image_view": 0,
|
||||||
"in_create": 0,
|
"in_create": 0,
|
||||||
"in_dialog": 0,
|
"in_dialog": 0,
|
||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-03-02 02:22:31.941850",
|
"modified": "2016-07-15 07:10:58.195489",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Job Applicant",
|
"name": "Job Applicant",
|
||||||
@@ -245,9 +248,11 @@
|
|||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"quick_entry": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"read_only_onload": 0,
|
"read_only_onload": 0,
|
||||||
"search_fields": "applicant_name",
|
"search_fields": "applicant_name",
|
||||||
"sort_order": "ASC",
|
"sort_order": "ASC",
|
||||||
"title_field": "applicant_name"
|
"title_field": "applicant_name",
|
||||||
|
"track_seen": 0
|
||||||
}
|
}
|
||||||
@@ -29,6 +29,10 @@ class JobApplicant(Document):
|
|||||||
self.check_email_id_is_unique()
|
self.check_email_id_is_unique()
|
||||||
validate_email_add(self.email_id, True)
|
validate_email_add(self.email_id, True)
|
||||||
|
|
||||||
|
if not self.applicant_name and self.email_id:
|
||||||
|
guess = self.email_id.split('@')[0]
|
||||||
|
self.applicant_name = ' '.join([p.capitalize() for p in guess.split('.')])
|
||||||
|
|
||||||
def check_email_id_is_unique(self):
|
def check_email_id_is_unique(self):
|
||||||
if self.email_id:
|
if self.email_id:
|
||||||
names = frappe.db.sql_list("""select name from `tabJob Applicant`
|
names = frappe.db.sql_list("""select name from `tabJob Applicant`
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ erpnext.utils.map_current_doc = function(opts) {
|
|||||||
}
|
}
|
||||||
var _map = function() {
|
var _map = function() {
|
||||||
// remove first item row if empty
|
// remove first item row if empty
|
||||||
if($.isArray(cur_frm.doc.items)) {
|
if($.isArray(cur_frm.doc.items) && cur_frm.doc.items.length > 0) {
|
||||||
if(!cur_frm.doc.items[0].item_code) {
|
if(!cur_frm.doc.items[0].item_code) {
|
||||||
cur_frm.doc.items = cur_frm.doc.items.splice(1);
|
cur_frm.doc.items = cur_frm.doc.items.splice(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user