Added Is Active to Sales Person

This commit is contained in:
Kanchan Chauhan 2016-12-12 11:12:07 +05:30
parent 58667ab123
commit f0b0db444d
5 changed files with 58 additions and 6 deletions

View File

@ -58,6 +58,15 @@ frappe.ui.form.on('Employee',{
},
update_contact:function(frm){
frm.set_value("prefered_email",frm.fields_dict[frappe.model.scrub(frm.doc.prefered_contact_email)].value)
}
},
status: function(frm) {
return frm.call({
method: "deactivate_sales_person",
args: {
employee: frm.doc.employee,
status: frm.doc.status
}
});
},
});
cur_frm.cscript = new erpnext.hr.EmployeeController({frm: cur_frm});

View File

@ -244,3 +244,9 @@ def is_holiday(employee, date=None):
if holiday_list:
return frappe.get_all('Holiday List', dict(name=holiday_list, holiday_date=date)) and True or False
@frappe.whitelist()
def deactivate_sales_person(status = None, employee = None):
if status == "Left":
sales_person = frappe.db.get_value("Sales Person", {"Employee": employee})
if sales_person:
frappe.db.set_value("Sales Person", sales_person, "enabled", 0)

View File

@ -355,4 +355,5 @@ erpnext.patches.v7_0.update_autoname_field
erpnext.patches.v7_1.update_bom_base_currency
erpnext.patches.v7_0.update_status_of_po_so
erpnext.patches.v7_1.set_budget_against_as_cost_center
erpnext.patches.v7_1.set_currency_exchange_date
erpnext.patches.v7_1.set_currency_exchange_date
erpnext.patches.v7_1.set_sales_person_status

View File

@ -0,0 +1,7 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc('setup','doctype','sales_person')
frappe.db.sql("""update `tabSales Person` set enabled=1
where employee IN (select employee from tabEmployee where status != "Left")""")

View File

@ -29,7 +29,7 @@
"label": "Name and Employee ID",
"length": 0,
"no_copy": 0,
"options": "fa fa-user",
"options": "icon-user",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -185,6 +185,35 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"fieldname": "enabled",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Enabled",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -290,7 +319,7 @@
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "fa fa-bullseye",
"options": "icon-bullseye",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -366,7 +395,7 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "fa fa-user",
"icon": "icon-user",
"idx": 1,
"image_view": 0,
"in_create": 0,
@ -375,7 +404,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-11-07 05:29:29.299529",
"modified": "2016-12-12 18:47:13.924225",
"modified_by": "Administrator",
"module": "Setup",
"name": "Sales Person",