mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
first cut for lazy loading framework
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
# DocType, Activity Type
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-02-23 11:22:28',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-02-21 15:43:40',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'field:activity_type',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'in_dialog': 1,
|
||||
'module': 'Projects',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 12
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'activity_type',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'label': 'Activity Type',
|
||||
'name': '__common__',
|
||||
'parent': 'Activity Type',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Activity Type',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Activity Type
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Activity Type'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'role': 'Projects User'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField'
|
||||
}
|
||||
]
|
||||
@@ -1,39 +0,0 @@
|
||||
//-------------------------- Onload ---------------------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||
}
|
||||
|
||||
//------------------- Get Contact Person based on customer selected ---------------------------
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
if(doc.customer)
|
||||
return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE (`tabContact`.is_customer = 1 AND `tabContact`.customer_name = "'+ doc.customer+'") AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
|
||||
else
|
||||
msgprint("Please select Customer first")
|
||||
}
|
||||
|
||||
//-------------------------------- get query select Territory ------------------------------------------
|
||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||
}
|
||||
|
||||
//------------------------ Customer and its primary contact Details ------------------------------------
|
||||
cur_frm.cscript.customer = function(doc, cdt, cdn) {
|
||||
if(doc.customer) get_server_fields('get_customer_details', '','', doc, cdt, cdn, 1);
|
||||
}
|
||||
|
||||
//--------------------- Customer's Contact Person Details --------------------------------------------
|
||||
cur_frm.cscript.contact_person = function(doc, cdt, cdn) {
|
||||
if(doc.contact_person) {
|
||||
get_server_fields('get_contact_details','','',doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//--------- calculate gross profit --------------------------------
|
||||
cur_frm.cscript.project_value = function(doc, cdt, cdn){
|
||||
get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1);
|
||||
}
|
||||
|
||||
//--------- calculate gross profit --------------------------------
|
||||
cur_frm.cscript.est_material_cost = function(doc, cdt, cdn){
|
||||
get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1);
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# Get Customer Details along with its primary contact details
|
||||
# ==============================================================
|
||||
def get_customer_details(self):
|
||||
details =sql("select address, territory, customer_group,customer_name from `tabCustomer` where name=%s and docstatus!=2",(self.doc.customer),as_dict=1)
|
||||
if details:
|
||||
ret = {
|
||||
'customer_address' : details and details[0]['address'] or '',
|
||||
'territory' : details and details[0]['territory'] or '',
|
||||
'customer_group' : details and details[0]['customer_group'] or '',
|
||||
'customer_name' : details and details[0]['customer_name'] or ''
|
||||
}
|
||||
#get primary contact details(this is done separately coz. , if join query used & no primary contact thn it would not be able to fetch customer details)
|
||||
contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact='Yes' and docstatus!=2" %(self.doc.customer), as_dict = 1)
|
||||
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
|
||||
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
|
||||
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
|
||||
return ret
|
||||
else:
|
||||
msgprint("Customer : %s does not exist in system." % (self.doc.customer))
|
||||
raise Exception
|
||||
|
||||
# Get customer's contact person details
|
||||
# ==============================================================
|
||||
def get_contact_details(self):
|
||||
contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc,contact_person,self.doc.customer), as_dict=1)
|
||||
if contact:
|
||||
ret = {
|
||||
'contact_no' : contact and contact[0]['contact_no'] or '',
|
||||
'email_id' : contact and contact[0]['email_id'] or ''
|
||||
}
|
||||
return ret
|
||||
else:
|
||||
msgprint("Contact Person : %s does not exist in the system." % (self.doc,contact_person))
|
||||
raise Exception
|
||||
|
||||
#calculate gross profit
|
||||
#=============================================
|
||||
def get_gross_profit(self):
|
||||
pft, per_pft =0, 0
|
||||
pft = flt(self.doc.project_value) - flt(self.doc.est_material_cost)
|
||||
#if pft > 0:
|
||||
per_pft = (flt(pft) / flt(self.doc.project_value)) * 100
|
||||
ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft}
|
||||
return ret
|
||||
|
||||
# validate
|
||||
#================================================
|
||||
def validate(self):
|
||||
if self.doc.project_start_date and self.doc.completion_date:
|
||||
if getdate(self.doc.completion_date) < getdate(self.doc.project_start_date):
|
||||
msgprint("Expected Completion Date can not be less than Project Start Date")
|
||||
raise Exception
|
||||
@@ -1,485 +0,0 @@
|
||||
# DocType, Project
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:14',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-01-05 15:24:43',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1305714062',
|
||||
'allow_trash': 1,
|
||||
'autoname': 'field:project_name',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Projects',
|
||||
'name': '__common__',
|
||||
'search_fields': 'customer, status, priority, is_active',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'subject': ' ',
|
||||
'tag_fields': 'status',
|
||||
'version': 32
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Project',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Project',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Project
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Project'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'role': 'All'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'role': 'Projects User'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Helps you keep track of your projects and links to Tasks. You can tag a task to a project to track its progress',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Basic Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'Project will get saved and will be searchable with project name given',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Project Name',
|
||||
'oldfieldname': 'project_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Open',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'in_filter': 1,
|
||||
'label': 'Status',
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Open\nCompleted\nCancelled',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'is_active',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'label': 'Is Active',
|
||||
'oldfieldname': 'is_active',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Yes\nNo',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'priority',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 5,
|
||||
'label': 'Priority',
|
||||
'oldfieldname': 'priority',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Medium\nLow\nHigh',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project_value',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Project Value',
|
||||
'oldfieldname': 'project_value',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'gross_margin_value',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Gross Margin Value',
|
||||
'oldfieldname': 'gross_margin_value',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'per_gross_margin',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Gross Margin %',
|
||||
'oldfieldname': 'per_gross_margin',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'est_material_cost',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Estimated Material Cost',
|
||||
'oldfieldname': 'est_material_cost',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project_type',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 10,
|
||||
'label': 'Project Type',
|
||||
'oldfieldname': 'project_type',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project_start_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 11,
|
||||
'in_filter': 1,
|
||||
'label': 'Project Start Date',
|
||||
'oldfieldname': 'project_start_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'completion_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 12,
|
||||
'label': 'Completion Date',
|
||||
'oldfieldname': 'completion_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'act_completion_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 13,
|
||||
'label': 'Actual Completion Date',
|
||||
'oldfieldname': 'act_completion_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 14,
|
||||
'label': 'Amended From',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amended_from',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amemdment_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 15,
|
||||
'label': 'Amemdment Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amemdment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 16,
|
||||
'label': 'Project Details',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 17,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 18,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'notes',
|
||||
'fieldtype': 'Text Editor',
|
||||
'idx': 19,
|
||||
'label': 'Notes',
|
||||
'oldfieldname': 'notes',
|
||||
'oldfieldtype': 'Text Editor',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 20,
|
||||
'label': 'Customer Details',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select name of Customer to whom project belongs',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 21,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer',
|
||||
'oldfieldname': 'customer',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Customer',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 22,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer Name',
|
||||
'oldfieldname': 'customer_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_address',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 23,
|
||||
'label': 'Customer Address',
|
||||
'oldfieldname': 'customer_address',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_person',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 24,
|
||||
'in_filter': 1,
|
||||
'label': 'Contact Person',
|
||||
'oldfieldname': 'contact_person',
|
||||
'oldfieldtype': 'Link',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 25,
|
||||
'in_filter': 1,
|
||||
'label': 'Territory',
|
||||
'oldfieldname': 'territory',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Territory',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 26,
|
||||
'label': 'Contact No',
|
||||
'oldfieldname': 'contact_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'email_id',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 27,
|
||||
'label': 'Email Id',
|
||||
'oldfieldname': 'email_id',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_group',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 28,
|
||||
'label': 'Customer Group',
|
||||
'oldfieldname': 'customer_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Customer Group',
|
||||
'permlevel': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Important dates and commitments in your project life cycle',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 29,
|
||||
'label': 'Milestones',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project_milestones',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 30,
|
||||
'label': 'Project Milestones',
|
||||
'oldfieldname': 'project_milestones',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Project Milestone',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'hidden': 1,
|
||||
'idx': 31,
|
||||
'label': 'Trash Reason',
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
||||
@@ -1,83 +0,0 @@
|
||||
cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
// created?
|
||||
if(cur_frm.mylist) {
|
||||
cur_frm.mylist.run();
|
||||
return;
|
||||
} else {
|
||||
|
||||
// create a new listing
|
||||
var lst = new Listing('Activities Updates');
|
||||
|
||||
lst.colwidths = ['5%','30%','40%','25%'];
|
||||
|
||||
// define options
|
||||
var opts = {};
|
||||
|
||||
opts.head_main_style = {};
|
||||
opts.cell_style = { padding:'3px 2px', borderRight : '0px', borderBottom : '1px solid #AAA', verticalAlign: 'top'}
|
||||
opts.head_style = { padding:'3px 2px', borderBottom : '1px solid #AAA'}
|
||||
opts.alt_cell_style = {};
|
||||
opts.hide_print = 1;
|
||||
opts.no_border = 1;
|
||||
|
||||
opts.hide_export = 1;
|
||||
opts.hide_print = 1;
|
||||
opts.hide_rec_label = 1;
|
||||
|
||||
lst.opts = opts;
|
||||
|
||||
// query
|
||||
lst.get_query = function() {
|
||||
var doc = cur_frm.doc;
|
||||
this.query = "select owner,creation,`update`, hours from `tabProject Activity Update` where parent = '"+doc.name+"'";
|
||||
this.query_max = "select count(*) from `tabProject Activity Update` where parent = '"+doc.name+"'";
|
||||
}
|
||||
|
||||
lst.show_cell = function(cell,ri,ci,d){
|
||||
|
||||
// owner and date
|
||||
if (ci==0){
|
||||
var d1 = $a(cell,'div');
|
||||
var img = $a(cell,'img','',{width:'40px'});
|
||||
set_user_img(img,d[ri][0])
|
||||
var d2 = $a(cell,'div');
|
||||
d2.innerHTML = d[ri][0] + ' on: ' + date.str_to_user(d[ri][1]);
|
||||
}
|
||||
|
||||
// update
|
||||
if(ci==1) {
|
||||
cell.innerHTML = replace_newlines(d[ri][2]);
|
||||
}
|
||||
|
||||
// Hours
|
||||
if (ci==2) {
|
||||
cell.innerHTML = d[ri][3] + ' hrs';
|
||||
}
|
||||
}
|
||||
|
||||
lst.make(cur_frm.fields_dict['Updates HTML'].wrapper);
|
||||
cur_frm.mylist = lst;
|
||||
lst.run();
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
|
||||
// show activities only after project is saved
|
||||
|
||||
var fl = ['new_update','Add','hours','Updates HTML'];
|
||||
if(doc.__islocal) {
|
||||
hide_field(fl);}
|
||||
else {
|
||||
unhide_field(fl); }
|
||||
}
|
||||
|
||||
cur_frm.cscript['Add'] = function(doc, dt, dn) {
|
||||
var callback = function(r,rt) {
|
||||
|
||||
// refresh listing
|
||||
cur_frm.mylist.run();
|
||||
|
||||
}
|
||||
$c_obj([doc],'add_update','',callback);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def add_update(self):
|
||||
d = Document('Project Activity Update')
|
||||
d.parent = self.doc.name
|
||||
d.update = self.doc.new_update
|
||||
d.hours = self.doc.hours
|
||||
d.save(1)
|
||||
|
||||
self.doc.new_update = ''
|
||||
self.doc.hours = ''
|
||||
@@ -1,175 +0,0 @@
|
||||
# DocType, Project Activity
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:14',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'Activity.######',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Projects',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 15
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Project Activity',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'name': '__common__',
|
||||
'parent': 'Project Activity',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'All',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Project Activity
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Project Activity'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 1,
|
||||
'label': 'Project',
|
||||
'oldfieldname': 'project',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Project'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'activity_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Activity Name',
|
||||
'oldfieldname': 'activity_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'print_hide': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'percent_complete',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'label': 'Percent Complete',
|
||||
'oldfieldname': 'percent_complete',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '0\n5\n10\n15\n20\n25\n30\n35\n40\n45\n50\n55\n60\n65\n70\n75\n80\n85\n90\n95\n100',
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'last_update',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 4,
|
||||
'label': 'Last Update',
|
||||
'oldfieldname': 'last_update',
|
||||
'oldfieldtype': 'Date',
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'last_update_by',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 5,
|
||||
'label': 'Last Update By',
|
||||
'oldfieldname': 'last_update_by',
|
||||
'oldfieldtype': 'Data',
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 6,
|
||||
'label': 'Updates',
|
||||
'oldfieldtype': 'Section Break'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 7,
|
||||
'label': 'Updates HTML',
|
||||
'oldfieldtype': 'HTML'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'new_update',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 8,
|
||||
'label': 'New Update',
|
||||
'oldfieldname': 'new_update',
|
||||
'oldfieldtype': 'Text'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'hours',
|
||||
'fieldtype': 'Float',
|
||||
'idx': 9,
|
||||
'label': 'Hours',
|
||||
'oldfieldname': 'hours',
|
||||
'oldfieldtype': 'Float'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 10,
|
||||
'label': 'Add',
|
||||
'oldfieldtype': 'Button',
|
||||
'trigger': 'Client'
|
||||
}
|
||||
]
|
||||
@@ -1,63 +0,0 @@
|
||||
# DocType, Project Activity Update
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:15',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Projects',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Project Activity Update',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Project Activity Update
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Project Activity Update'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'update',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 1,
|
||||
'label': 'Update',
|
||||
'oldfieldname': 'update',
|
||||
'oldfieldtype': 'Text'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'e.g. 0.5, 2.5 etc',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'hours',
|
||||
'fieldtype': 'Float',
|
||||
'idx': 2,
|
||||
'label': 'Hours',
|
||||
'oldfieldname': 'hours',
|
||||
'oldfieldtype': 'Float'
|
||||
}
|
||||
]
|
||||
@@ -1,116 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d,dl
|
||||
|
||||
def get_projects(self, arg):
|
||||
# project list
|
||||
pl=[]
|
||||
status={}
|
||||
if arg == 'Open':
|
||||
pl = [p[0] for p in sql("select name from `tabProject` where status = 'Open' order by creation desc limit 20")]
|
||||
for p1 in pl:
|
||||
status[p1] = 'Open'
|
||||
elif arg == 'Completed':
|
||||
pl = [p[0] for p in sql("select name from `tabProject` where status = 'Completed' order by creation desc limit 20")]
|
||||
for p2 in pl:
|
||||
status[p2] = 'Completed'
|
||||
elif arg == 'Cancelled':
|
||||
pl = [p[0] for p in sql("select name from `tabProject` where status = 'Cancelled' order by creation desc limit 20")]
|
||||
for p3 in pl:
|
||||
status[p3] = 'Cancelled'
|
||||
else:
|
||||
#pl = [p[0] for p in sql("select name from `tabProject` order by creation desc limit 20")]
|
||||
pl1 = sql("select name, status from `tabProject` order by creation desc limit 20", as_dict=1)
|
||||
for p4 in pl1:
|
||||
status[p4['name']] = p4['status']
|
||||
pl.append(p4['name'])
|
||||
|
||||
# milestones in the next 7 days for active projects
|
||||
ml = convert_to_lists(sql("select t1.milestone_date, t1.milestone, t1.parent from `tabProject Milestone` t1, tabProject t2 where t1.parent = t2.name and t2.status='Open' and DATEDIFF(t1.milestone_date, CURDATE()) BETWEEN 0 AND 7 ORDER BY t1.milestone_date ASC"))
|
||||
|
||||
# percent of activity completed per project
|
||||
comp = {}
|
||||
n_tasks = {}
|
||||
|
||||
for p in pl:
|
||||
t1 = sql('select count(*) from tabTicket where project=%s and docstatus!=2', p)[0][0]
|
||||
n_tasks[p] = t1 or 0
|
||||
if t1:
|
||||
t2 = sql('select count(*) from tabTicket where project=%s and docstatus!=2 and status="Closed"', p)[0][0]
|
||||
comp[p] = cint(flt(t2)*100/t1)
|
||||
|
||||
return {'pl':pl, 'ml':ml, 'comp':comp, 'n_tasks':n_tasks, 'status':status}
|
||||
|
||||
def get_resources(self):
|
||||
ret = {}
|
||||
|
||||
# resource list
|
||||
rl = sql("select distinct allocated_to, assignee_email from tabTicket")
|
||||
|
||||
# get open & closed tickets
|
||||
for r in rl:
|
||||
if r[0]:
|
||||
ret[r[1]] = {}
|
||||
ret[r[1]]['id'] = r[0]
|
||||
ret[r[1]]['Total'] = sql("select count(*) from tabTicket where allocated_to=%s and docstatus!=2", r[0])[0][0]
|
||||
ret[r[1]]['Closed'] = sql("select count(*) from tabTicket where allocated_to=%s and status='Closed' and docstatus!=2", r[0])[0][0]
|
||||
ret[r[1]]['percent'] = cint(flt(ret[r[1]]['Closed']) * 100 / ret[r[1]]['Total'])
|
||||
|
||||
return ret
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# for Gantt Chart
|
||||
|
||||
def get_init_data(self, arg=''):
|
||||
pl = [p[0] for p in sql('select name from tabProject where docstatus != 2')]
|
||||
rl = [p[0] for p in sql('select distinct allocated_to from tabTicket where docstatus != 2 and ifnull(allocated_to,"") != ""')]
|
||||
return {'pl':pl, 'rl':rl}
|
||||
|
||||
def get_tasks(self, arg):
|
||||
start_date, end_date, project, resource = arg.split('~~~')
|
||||
|
||||
cl = ''
|
||||
if project and project != 'All':
|
||||
cl = " and ifnull(project,'') = '%s'" % project
|
||||
|
||||
if resource and resource != 'All':
|
||||
cl = " and ifnull(allocated_to,'') = '%s'" % resource
|
||||
|
||||
tl = sql("""
|
||||
select subject, allocated_to, project, exp_start_date, exp_end_date, priority, status, name
|
||||
from tabTicket
|
||||
where
|
||||
((exp_start_date between '%(st)s' and '%(end)s') or
|
||||
(exp_end_date between '%(st)s' and '%(end)s') or
|
||||
(exp_start_date < '%(st)s' and exp_end_date > '%(end)s')) %(cond)s order by exp_start_date limit 100""" % {'st': start_date, 'end': end_date, 'cond':cl})
|
||||
|
||||
return convert_to_lists(tl)
|
||||
|
||||
def declare_proj_completed(self, arg):
|
||||
chk = sql("select name from `tabTicket` where project=%s and status='Open'", arg)
|
||||
if chk:
|
||||
chk_lst = [x[0] for x in chk]
|
||||
msgprint("Task(s) "+','.join(chk_lst)+" has staus 'Open'. Please submit all tasks against this project before closing the project.")
|
||||
return cstr('false')
|
||||
else:
|
||||
sql("update `tabProject` set status = 'Completed' where name = %s", arg)
|
||||
return cstr('true')
|
||||
@@ -1,30 +0,0 @@
|
||||
# DocType, Project Control
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:15',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-23 10:43:22',
|
||||
'modified_by': 'umair@iwebnotes.com',
|
||||
'owner': 'harshada@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Projects',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 30
|
||||
},
|
||||
|
||||
# DocType, Project Control
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Project Control'
|
||||
}
|
||||
]
|
||||
@@ -1,84 +0,0 @@
|
||||
# DocType, Project Milestone
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:15',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-01-05 15:24:43',
|
||||
'modified_by': 'sneha@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Projects',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 2
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Project Milestone',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Project Milestone
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Project Milestone'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'milestone_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 1,
|
||||
'label': 'Milestone Date',
|
||||
'oldfieldname': 'milestone_date',
|
||||
'oldfieldtype': 'Date'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'actual_completion_date_',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 2,
|
||||
'label': 'Actual Completion Date '
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'milestone',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 3,
|
||||
'label': 'Milestone',
|
||||
'oldfieldname': 'milestone',
|
||||
'oldfieldtype': 'Text',
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'label': 'Status',
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Pending\nCompleted'
|
||||
}
|
||||
]
|
||||
@@ -1,106 +0,0 @@
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
if(!doc.senders_name) {
|
||||
doc.senders_name = user_fullname;
|
||||
doc.senders_email = user;
|
||||
refresh_many(['senders_name', 'senders_email']);
|
||||
}
|
||||
|
||||
if(doc.__islocal) {
|
||||
doc.status = 'Open';
|
||||
doc.opening_date = get_today();
|
||||
refresh_many(['status', 'opening_date']);
|
||||
}
|
||||
else{
|
||||
if(!doc.opening_date){
|
||||
doc.opening_date = dateutil.str_to_user(only_date(doc.creation));
|
||||
refresh_field('opening_date');
|
||||
}
|
||||
}
|
||||
|
||||
//hide unhide field depends on status
|
||||
if(doc.status == 'Open') doc.review_date = doc.closing_date = '';
|
||||
else if(doc.status == 'Pending Review') doc.closing_date = '';
|
||||
refresh_many(['closing_date','review_date']);
|
||||
|
||||
if(doc.project) cur_frm.cscript.project(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn) {
|
||||
cur_frm.clear_custom_buttons();
|
||||
if(doc.status == 'Pending Review' && (doc.senders_name == user_fullname || doc.senders_email == user)) {
|
||||
cur_frm.add_custom_button('Declare Completed', cur_frm.cscript['Declare Completed']);
|
||||
cur_frm.add_custom_button('Reopen Task', cur_frm.cscript['Reopen Task']);
|
||||
}
|
||||
if(doc.status == 'Open' && !doc.__islocal) {
|
||||
cur_frm.add_custom_button('Cancel Task', cur_frm.cscript['Cancel Task']);
|
||||
if(doc.allocated_to == user) cur_frm.add_custom_button('Get Approval', cur_frm.cscript['Get Approval']);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['project'].get_query = function(doc,cdt,cdn){
|
||||
var cond='';
|
||||
if(doc.customer) cond = 'ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND';
|
||||
|
||||
return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond});
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.project = function(doc, cdt, cdn){
|
||||
if(doc.project) get_server_fields('get_project_details', '','', doc, cdt, cdn, 1);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer'].get_query = function(doc,cdt,cdn){
|
||||
var cond='';
|
||||
if(doc.project) cond = 'ifnull(`tabProject`.customer, "") = `tabCustomer`.name AND ifnull(`tabProject`.name, "") = "'+doc.project+'" AND';
|
||||
|
||||
return repl('SELECT distinct `tabCustomer`.`name` FROM `tabCustomer`, `tabProject` WHERE %(cond)s `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` ASC LIMIT 50', {cond:cond});
|
||||
}
|
||||
|
||||
cur_frm.cscript.customer = function(doc, cdt, cdn){
|
||||
if(doc.customer) get_server_fields('get_customer_details', '','', doc, cdt, cdn, 1);
|
||||
else doc.customer_name ='';
|
||||
}
|
||||
|
||||
cur_frm.cscript.allocated_to = function(doc,cdt,cdn){
|
||||
get_server_fields('get_allocated_to_name','','',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
cur_frm.cscript['Get Approval'] = function(){
|
||||
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'set_for_review', '',function(r, rt) {
|
||||
if(r.message == 'true'){
|
||||
doc.status = 'Pending Review'; //for refresh
|
||||
refresh_many(['review_date','status']);
|
||||
cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript['Reopen Task'] = function(){
|
||||
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'reopen_task', '',function(r, rt) {
|
||||
if(r.message == 'true'){
|
||||
doc.status = 'Open'; //for refresh
|
||||
refresh_many(['status']);
|
||||
cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript['Cancel Task'] = function(){
|
||||
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name), 'cancel_task', '',function(r, rt) {
|
||||
if(r.message == 'true'){
|
||||
doc.status = 'Cancelled'; //for refresh
|
||||
refresh_many(['status']);
|
||||
cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript['Declare Completed'] = function(){
|
||||
$c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_completed', '',function(r, rt) {
|
||||
if(r.message == 'true'){
|
||||
doc.status = 'Closed'; //for refresh
|
||||
refresh_many(['review_date', 'closing_date', 'status']);
|
||||
cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def get_project_details(self):
|
||||
cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project)
|
||||
if cust:
|
||||
ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
|
||||
return ret
|
||||
|
||||
def get_customer_details(self):
|
||||
cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
|
||||
if cust:
|
||||
ret = {'customer_name': cust and cust[0][0] or ''}
|
||||
return ret
|
||||
|
||||
def get_allocated_to_name(self):
|
||||
as_em = sql("select first_name, last_name from `tabProfile` where name=%s",self.doc.allocated_to)
|
||||
ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
|
||||
return ret
|
||||
|
||||
# validate
|
||||
#--------------------------------------------
|
||||
|
||||
|
||||
def validate(self):
|
||||
if not self.doc.opening_date:
|
||||
msgprint("Please enter Opening Date.")
|
||||
raise Exception
|
||||
elif getdate(self.doc.opening_date) > getdate(nowdate()):
|
||||
msgprint("Opening date can not be future date")
|
||||
raise Exception
|
||||
|
||||
if self.doc.exp_start_date and self.doc.exp_end_date and getdate(self.doc.exp_start_date) > getdate(self.doc.exp_end_date):
|
||||
msgprint("'Expected Start Date' can not be greater than 'Expected End Date'")
|
||||
raise Exception
|
||||
|
||||
if self.doc.act_start_date and self.doc.act_end_date and getdate(self.doc.act_start_date) > getdate(self.doc.act_end_date):
|
||||
msgprint("'Actual Start Date' can not be greater than 'Actual End Date'")
|
||||
raise Exception
|
||||
|
||||
if self.doc.opening_date and self.doc.review_date and getdate(self.doc.opening_date) > getdate(self.doc.review_date):
|
||||
msgprint("Review Date should be greater than or equal to Opening Date ")
|
||||
raise Exception
|
||||
|
||||
if self.doc.closing_date and self.doc.review_date and getdate(self.doc.closing_date) < getdate(self.doc.review_date):
|
||||
msgprint("Closing Date should be greater than or equal to Review Date ")
|
||||
raise Exception
|
||||
|
||||
# on update
|
||||
#--------------------------------------------
|
||||
|
||||
def on_update(self):
|
||||
pass
|
||||
|
||||
#validate before sending for approval
|
||||
def validate_for_pending_review(self):
|
||||
if not self.doc.allocated_to:
|
||||
msgprint("Please enter allocated_to.")
|
||||
raise Exception
|
||||
self.validate_with_timesheet_dates()
|
||||
|
||||
#validate before closing task
|
||||
def validate_for_closed(self):
|
||||
self.check_non_submitted_timesheets()
|
||||
self.get_actual_total_hrs()
|
||||
|
||||
def check_non_submitted_timesheets(self):
|
||||
chk = sql("select t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent=t1.name and t2.task_id=%s and t1.status='Draft'", self.doc.name)
|
||||
if chk:
|
||||
chk_lst = [x[0] for x in chk]
|
||||
msgprint("Please submit timesheet(s) : "+','.join(chk_lst)+" before declaring this task as completed. As details of this task present in timesheet(s)")
|
||||
raise Exception
|
||||
|
||||
#calculate actual total hours taken to complete task from timesheets
|
||||
def get_actual_total_hrs(self):
|
||||
import datetime
|
||||
import time
|
||||
chk = sql("select t2.act_total_hrs from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' and ifnull(t2.act_total_hrs, '')!='' order by t1.timesheet_date asc", self.doc.name)
|
||||
if chk:
|
||||
chk_lst = [x[0] for x in chk]
|
||||
actual_total = total =0
|
||||
|
||||
for m in chk_lst:
|
||||
m1, m2=[], 0
|
||||
m1 = m.split(":")
|
||||
m2 = (datetime.timedelta(minutes=cint(m1[1]), hours=cint(m1[0]))).seconds
|
||||
total = total + m2
|
||||
|
||||
actual_total = time.strftime("%H:%M", time.gmtime(total))
|
||||
set(self.doc, 'act_total_hrs', actual_total)
|
||||
|
||||
# validate and fetch actual start and end date
|
||||
def validate_with_timesheet_dates(self):
|
||||
chk = sql("select t1.name, t1.timesheet_date from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status = 'Submitted' order by t1.timesheet_date asc", self.doc.name, as_dict=1)
|
||||
if chk:
|
||||
if self.doc.act_start_date:
|
||||
if chk[0]['timesheet_date'] > getdate(self.doc.act_start_date) or chk[0]['timesheet_date'] < getdate(self.doc.act_start_date):
|
||||
msgprint("Actual start date of this task is "+cstr(chk[0]['timesheet_date'])+" as per timesheet "+cstr(chk[0]['name']))
|
||||
raise Exception
|
||||
else:
|
||||
self.doc.act_start_date = chk[0]['timesheet_date']
|
||||
|
||||
if self.doc.act_end_date:
|
||||
if chk[len(chk)-1]['timesheet_date'] < getdate(self.doc.act_end_date) or chk[len(chk)-1]['timesheet_date'] > getdate(self.doc.act_end_date):
|
||||
msgprint("Actual end date of this task is "+cstr(chk[len(chk)-1]['timesheet_date'])+" as per timesheet "+cstr(chk[len(chk)-1]['name']))
|
||||
raise Exception
|
||||
else:
|
||||
self.doc.act_end_date = chk[len(chk)-1]['timesheet_date']
|
||||
|
||||
def set_for_review(self):
|
||||
self.check_non_submitted_timesheets()
|
||||
self.validate_for_pending_review()
|
||||
self.get_actual_total_hrs()
|
||||
self.doc.review_date = nowdate()
|
||||
set(self.doc, 'status', 'Pending Review')
|
||||
self.doc.save()
|
||||
return cstr('true')
|
||||
|
||||
def reopen_task(self):
|
||||
set(self.doc, 'status', 'Open')
|
||||
self.doc.save()
|
||||
return cstr('true')
|
||||
|
||||
def declare_completed(self):
|
||||
if self.doc.status == 'Open':
|
||||
self.validate_for_pending_review()
|
||||
self.doc.review_date = nowdate()
|
||||
else:
|
||||
self.validate_with_timesheet_dates()
|
||||
self.validate_for_closed()
|
||||
self.doc.closing_date = nowdate()
|
||||
set(self.doc, 'status', 'Closed')
|
||||
set(self.doc, 'docstatus', 1)
|
||||
self.doc.save()
|
||||
return cstr('true')
|
||||
|
||||
def cancel_task(self):
|
||||
chk = sql("select distinct t1.name from `tabTimesheet` t1, `tabTimesheet Detail` t2 where t2.parent = t1.name and t2.task_id = %s and t1.status!='Cancelled'", self.doc.name)
|
||||
if chk:
|
||||
chk_lst = [x[0] for x in chk]
|
||||
msgprint("Timesheet(s) "+','.join(chk_lst)+" created against this task. Thus can not be cancelled")
|
||||
raise Exception
|
||||
else:
|
||||
set(self.doc, 'status', 'Cancelled')
|
||||
set(self.doc, 'docstatus', 2)
|
||||
self.doc.save()
|
||||
return cstr('true')
|
||||
|
||||
def on_cancel(self):
|
||||
self.cancel_task()
|
||||
@@ -1,575 +0,0 @@
|
||||
# DocType, Ticket
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-01-28 17:52:35',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-03 10:04:58',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1307707462',
|
||||
'allow_trash': 1,
|
||||
'autoname': 'TIC/.####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Projects',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': '%(subject)s',
|
||||
'tag_fields': 'status',
|
||||
'version': 245
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Ticket',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Ticket',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Ticket
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Ticket'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'role': 'All',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'role': 'All',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'role': 'Projects User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 1,
|
||||
'role': 'Projects User'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Task Details',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0,
|
||||
'search_index': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'subject',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'in_filter': 1,
|
||||
'label': 'Subject',
|
||||
'oldfieldname': 'subject',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'label': 'Status',
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Open\nPending Review\nClosed\nCancelled',
|
||||
'permlevel': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'opening_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 4,
|
||||
'label': 'Creation Date',
|
||||
'oldfieldname': 'opening_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:doc.status == "Closed" || doc.status == "Pending Review"',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'review_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 5,
|
||||
'label': 'Review Date',
|
||||
'oldfieldname': 'review_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:doc.status == "Closed"',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'closing_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 6,
|
||||
'label': 'Closing Date',
|
||||
'oldfieldname': 'closing_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'priority',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'Priority',
|
||||
'oldfieldname': 'priority',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Low\nMedium\nHigh\nUrgent',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 8,
|
||||
'label': 'Project',
|
||||
'oldfieldname': 'project',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Project',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 9,
|
||||
'label': 'Customer',
|
||||
'oldfieldname': 'customer',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Customer',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 10,
|
||||
'label': 'Customer Name',
|
||||
'oldfieldname': 'customer_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 11,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'allocated_to',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 12,
|
||||
'label': 'Allocated To',
|
||||
'oldfieldname': 'allocated_to',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Profile',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'allocated_to_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 13,
|
||||
'label': 'Allocated To Name',
|
||||
'oldfieldname': 'allocated_to_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'senders_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 14,
|
||||
'in_filter': 1,
|
||||
'label': 'Raised By',
|
||||
'oldfieldname': 'senders_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'senders_email',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 15,
|
||||
'label': 'Email',
|
||||
'oldfieldname': 'senders_email',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'senders_contact_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 16,
|
||||
'label': 'Senders Contact No',
|
||||
'oldfieldname': 'senders_contact_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'senders_company',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 17,
|
||||
'label': 'Senders Company',
|
||||
'oldfieldname': 'senders_company',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'category',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 18,
|
||||
'label': 'Category',
|
||||
'oldfieldname': 'category',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Ticket Category',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'external_or_internal',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 19,
|
||||
'label': 'External or Internal',
|
||||
'oldfieldname': 'external_or_internal',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'External\nInternal',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 20,
|
||||
'label': 'Amended From',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amended_from',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amendment_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 21,
|
||||
'label': 'Amendment Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amendment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 22,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text Editor',
|
||||
'idx': 23,
|
||||
'label': 'Details',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text Editor',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'first_creation_flag',
|
||||
'fieldtype': 'Int',
|
||||
'hidden': 1,
|
||||
'idx': 24,
|
||||
'in_filter': 0,
|
||||
'label': 'First Creation Flag',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'first_creation_flag',
|
||||
'oldfieldtype': 'Int',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'second_creation_flag',
|
||||
'fieldtype': 'Int',
|
||||
'hidden': 1,
|
||||
'idx': 25,
|
||||
'label': 'Second Creation Flag',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'second_creation_flag',
|
||||
'oldfieldtype': 'Int',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 26,
|
||||
'label': 'Time and Budget',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 27,
|
||||
'label': 'Expected',
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'exp_start_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 28,
|
||||
'label': 'Expected Start Date',
|
||||
'oldfieldname': 'exp_start_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'exp_end_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 29,
|
||||
'in_filter': 1,
|
||||
'label': 'Expected End Date',
|
||||
'oldfieldname': 'exp_end_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'exp_total_hrs',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 30,
|
||||
'label': 'Total Hours (Expected)',
|
||||
'oldfieldname': 'exp_total_hrs',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'allocated_budget',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 31,
|
||||
'label': 'Allocated Budget',
|
||||
'oldfieldname': 'allocated_budget',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 32,
|
||||
'label': 'Actual',
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'act_start_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 33,
|
||||
'label': 'Actual Start Date',
|
||||
'oldfieldname': 'act_start_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'act_end_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 34,
|
||||
'label': 'Actual End Date',
|
||||
'oldfieldname': 'act_end_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'act_total_hrs',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 35,
|
||||
'label': 'Total Hours (Actual)',
|
||||
'oldfieldname': 'act_total_hrs',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'actual_budget',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 36,
|
||||
'label': 'Actual Budget',
|
||||
'oldfieldname': 'actual_budget',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
// ======================= OnLoad =============================================
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||
if(!doc.timesheet_date) set_multiple(cdt,cdn,{timesheet_date:get_today()});
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){}
|
||||
|
||||
|
||||
cur_frm.fields_dict['timesheet_details'].grid.get_field("project_name").get_query = function(doc,cdt,cdn){
|
||||
var cond=cond1='';
|
||||
var d = locals[cdt][cdn];
|
||||
//if(d.customer_name) cond = 'ifnull(`tabProject`.customer_name, "") = "'+d.customer_name+'" AND';
|
||||
if(d.task_id) cond1 = 'ifnull(`tabTicket`.project, "") = `tabProject`.name AND `tabTicket`.name = "'+d.task_id+'" AND';
|
||||
|
||||
return repl('SELECT distinct `tabProject`.`name` FROM `tabProject`, `tabTicket` WHERE %(cond1)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond1:cond1});
|
||||
}
|
||||
|
||||
cur_frm.cscript.task_name = function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.task_name) get_server_fields('get_task_details', d.task_name, 'timesheet_details', doc, cdt, cdn, 1);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['timesheet_details'].grid.get_field("task_name").get_query = function(doc,cdt,cdn){
|
||||
var cond='';
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.project_name) cond = 'ifnull(`tabTicket`.project, "") = "'+d.project_name+'" AND';
|
||||
|
||||
return repl('SELECT distinct `tabTicket`.`subject` FROM `tabTicket` WHERE %(cond)s `tabTicket`.`subject` LIKE "%s" ORDER BY `tabTicket`.`subject` ASC LIMIT 50', {cond:cond});
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def get_customer_details(self, project_name):
|
||||
cust = sql("select customer, customer_name from `tabProject` where name = %s", project_name)
|
||||
if cust:
|
||||
ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
|
||||
return (ret)
|
||||
|
||||
def get_task_details(self, task_sub):
|
||||
tsk = sql("select name, project, customer, customer_name from `tabTicket` where subject = %s", task_sub)
|
||||
if tsk:
|
||||
ret = {'task_id': tsk and tsk[0][0] or '', 'project_name': tsk and tsk[0][1] or '', 'customer_name': tsk and tsk[0][3] or ''}
|
||||
return ret
|
||||
|
||||
def validate(self):
|
||||
if getdate(self.doc.timesheet_date) > getdate(nowdate()):
|
||||
msgprint("You can not prepare timesheet for future date")
|
||||
raise Exception
|
||||
|
||||
chk = sql("select name from `tabTimesheet` where timesheet_date=%s and owner=%s and status!='Cancelled' and name!=%s", (self.doc.timesheet_date, self.doc.owner, self.doc.name))
|
||||
if chk:
|
||||
msgprint("You have already created timesheet "+ cstr(chk and chk[0][0] or '')+" for this date.")
|
||||
raise Exception
|
||||
|
||||
import time
|
||||
for d in getlist(self.doclist, 'timesheet_details'):
|
||||
if d.act_start_time and d.act_end_time:
|
||||
d1 = time.strptime(d.act_start_time, "%H:%M")
|
||||
d2 = time.strptime(d.act_end_time, "%H:%M")
|
||||
|
||||
if d1 > d2:
|
||||
msgprint("Start time can not be greater than end time. Check for Task Id : "+cstr(d.task_id))
|
||||
raise Exception
|
||||
elif d1 == d2:
|
||||
msgprint("Start time and end time can not be same. Check for Task Id : "+cstr(d.task_id))
|
||||
raise Exception
|
||||
|
||||
def calculate_total_hr(self):
|
||||
import datetime
|
||||
import time
|
||||
for d in getlist(self.doclist, 'timesheet_details'):
|
||||
x1 = d.act_start_time.split(":")
|
||||
x2 = d.act_end_time.split(":")
|
||||
|
||||
d1 = datetime.timedelta(minutes=cint(x1[1]), hours=cint(x1[0]))
|
||||
d2 = datetime.timedelta(minutes=cint(x2[1]), hours=cint(x2[0]))
|
||||
d3 = (d2 - d1).seconds
|
||||
d.act_total_hrs = time.strftime("%H:%M", time.gmtime(d3))
|
||||
sql("update `tabTimesheet Detail` set act_total_hrs = %s where parent=%s and name=%s", (d.act_total_hrs,self.doc.name,d.name))
|
||||
|
||||
def on_update(self):
|
||||
self.calculate_total_hr()
|
||||
set(self.doc, 'status', 'Draft')
|
||||
|
||||
def on_submit(self):
|
||||
set(self.doc, 'status', 'Submitted')
|
||||
|
||||
def on_cancel(self):
|
||||
set(self.doc, 'status', 'Cancelled')
|
||||
@@ -1,219 +0,0 @@
|
||||
# DocType, Timesheet
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-12-14 10:23:29',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-02-23 11:22:29',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'ashwini@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'TimeSheet.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Projects',
|
||||
'name': '__common__',
|
||||
'search_fields': 'status, owner, timesheet_date',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'subject': '%(owner)s',
|
||||
'version': 68
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Timesheet',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Timesheet',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Timesheet
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Timesheet'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': 'Projects User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': 'Projects User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1,
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Timesheet Details',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Draft',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 2,
|
||||
'in_filter': 0,
|
||||
'label': 'Status',
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nDraft\nSubmitted\nCancelled',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Today',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'timesheet_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 3,
|
||||
'in_filter': 1,
|
||||
'label': 'Timesheet Date',
|
||||
'oldfieldname': 'timesheet_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'owner',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'in_filter': 1,
|
||||
'label': 'Timesheet By',
|
||||
'oldfieldname': 'owner',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Profile',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 5,
|
||||
'label': 'Amended From',
|
||||
'oldfieldname': 'amended_from',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amendment_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 6,
|
||||
'label': 'Amendment Date',
|
||||
'oldfieldname': 'amendment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 7,
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'notes',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 8,
|
||||
'label': 'Notes',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 9,
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'timesheet_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 10,
|
||||
'label': 'Timesheet Details',
|
||||
'oldfieldname': 'timesheet_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Timesheet Detail',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
||||
@@ -1,169 +0,0 @@
|
||||
# DocType, Timesheet Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-02-23 11:22:29',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-02-23 11:22:28',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'TSD.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Projects',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'version': 15
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Timesheet Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Timesheet Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Timesheet Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'act_start_time',
|
||||
'fieldtype': 'Time',
|
||||
'idx': 1,
|
||||
'label': 'Actual Start Time',
|
||||
'oldfieldname': 'act_start_time',
|
||||
'oldfieldtype': 'Time',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': '160px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'act_end_time',
|
||||
'fieldtype': 'Time',
|
||||
'idx': 2,
|
||||
'label': 'Actual End Time',
|
||||
'oldfieldname': 'act_end_time',
|
||||
'oldfieldtype': 'Time',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': '160px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'activity_type',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Activity Type',
|
||||
'options': 'Activity Type',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0,
|
||||
'width': '200px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'other_details',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 4,
|
||||
'label': 'Additional Info',
|
||||
'oldfieldname': 'other_details',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0,
|
||||
'width': '200px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'act_total_hrs',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 5,
|
||||
'label': 'Total Hours (Actual)',
|
||||
'oldfieldname': 'act_total_hrs',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 6,
|
||||
'label': 'Customer Name',
|
||||
'oldfieldname': 'customer_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': 'Customer',
|
||||
'permlevel': 0,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'project_name',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'Project',
|
||||
'oldfieldname': 'project_name',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Project',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'task_id',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 8,
|
||||
'in_filter': 1,
|
||||
'label': 'Task Id',
|
||||
'oldfieldname': 'task_id',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Ticket',
|
||||
'permlevel': 0,
|
||||
'search_index': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'task_name',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 9,
|
||||
'label': 'Task Name',
|
||||
'oldfieldname': 'task_name',
|
||||
'oldfieldtype': 'Link',
|
||||
'permlevel': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0,
|
||||
'width': '250px'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user