moved directory structure

This commit is contained in:
Rushabh Mehta
2012-09-24 19:13:42 +05:30
parent e47a6779e9
commit 2fa2f7178d
1637 changed files with 47 additions and 11450 deletions

View File

@@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@@ -0,0 +1,5 @@
You can use projects to:
1. Track budgets (Purchase Orders, Invoices).
2. Track material consumption.
3. Create and assign tasks (and view them on a Gantt Chart).

View File

@@ -0,0 +1,29 @@
// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// show tasks
cur_frm.cscript.refresh = function(doc) {
if(!doc.__islocal) {
// refresh gantt chart
wn.require('erpnext/projects/gantt_task.js');
if(!cur_frm.gantt_area)
cur_frm.gantt_area = $('<div>')
.appendTo(cur_frm.fields_dict.project_tasks.wrapper);
cur_frm.gantt_area.empty();
erpnext.show_task_gantt(cur_frm.gantt_area, cur_frm.docname);
}
}

View File

@@ -0,0 +1,112 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Please edit this list and import only required elements
from __future__ import unicode_literals
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, getchildren, make_autoname
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, phone, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact=1 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]['phone'] 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
def on_update(self):
# update milestones
webnotes.conn.sql("""delete from tabEvent where ref_type='Project' and ref_name=%s""",
self.doc.name)
for d in self.doclist:
if d.doctype=='Project Milestone' and d.docstatus!=2:
self.add_calendar_event(d.milestone, d.milestone_date)
def add_calendar_event(self, milestone, date):
""" Add calendar event for task in calendar of Allocated person"""
event = Document('Event')
event.description = milestone + ' for ' + self.doc.name
event.event_date = date
event.event_hour = '10:00'
event.event_type = 'Public'
event.ref_type = 'Project'
event.ref_name = self.doc.name
event.save(1)

View File

@@ -0,0 +1,524 @@
# DocType, Project
[
# These values are common in all dictionaries
{
'creation': '2012-08-08 13:25:19',
'docstatus': 0,
'modified': '2012-08-08 13:55:01',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1305714062',
'allow_attach': 1,
'allow_trash': 1,
'autoname': u'field:project_name',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
'document_type': u'Master',
'max_attachments': 4,
'module': u'Projects',
'name': '__common__',
'search_fields': u'customer, status, priority, is_active',
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u' ',
'tag_fields': u'status',
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Project',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Project',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1,
'role': u'Projects User',
'write': 1
},
# DocType, Project
{
'doctype': 'DocType',
'name': u'Project'
},
# DocPerm
{
'doctype': u'DocPerm'
},
# DocField
{
'colour': u'White:FFF',
'description': u'Helps you keep track of your projects and links to Tasks. You can tag a task to a project to track its progress',
'doctype': u'DocField',
'fieldname': u'basic_info',
'fieldtype': u'Section Break',
'label': u'Basic Info',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cb_project_status',
'fieldtype': u'Column Break',
'label': u'Status',
'permlevel': 0
},
# DocField
{
'description': u'Project will get saved and will be searchable with project name given',
'doctype': u'DocField',
'fieldname': u'project_name',
'fieldtype': u'Data',
'label': u'Project Name',
'no_copy': 0,
'oldfieldname': u'project_name',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'default': u'Open',
'doctype': u'DocField',
'fieldname': u'status',
'fieldtype': u'Select',
'in_filter': 1,
'label': u'Status',
'no_copy': 1,
'oldfieldname': u'status',
'oldfieldtype': u'Select',
'options': u'Open\nCompleted\nCancelled',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'is_active',
'fieldtype': u'Select',
'label': u'Is Active',
'no_copy': 0,
'oldfieldname': u'is_active',
'oldfieldtype': u'Select',
'options': u'Yes\nNo',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'priority',
'fieldtype': u'Select',
'label': u'Priority',
'no_copy': 0,
'oldfieldname': u'priority',
'oldfieldtype': u'Select',
'options': u'Medium\nLow\nHigh',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cb_project_dates',
'fieldtype': u'Column Break',
'label': u'Dates',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_start_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Project Start Date',
'no_copy': 0,
'oldfieldname': u'project_start_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'completion_date',
'fieldtype': u'Date',
'label': u'Completion Date',
'no_copy': 0,
'oldfieldname': u'completion_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'act_completion_date',
'fieldtype': u'Date',
'label': u'Actual Completion Date',
'no_copy': 0,
'oldfieldname': u'act_completion_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_type',
'fieldtype': u'Select',
'label': u'Project Type',
'no_copy': 0,
'oldfieldname': u'project_type',
'oldfieldtype': u'Data',
'options': u'Internal\nExternal\nOther',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Important dates and commitments in your project life cycle',
'doctype': u'DocField',
'fieldname': u'sb_milestones',
'fieldtype': u'Section Break',
'label': u'Milestones',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Milestones will be added as Events in the Calendar',
'doctype': u'DocField',
'fieldname': u'project_milestones',
'fieldtype': u'Table',
'label': u'Project Milestones',
'no_copy': 0,
'oldfieldname': u'project_milestones',
'oldfieldtype': u'Table',
'options': u'Project Milestone',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Tasks belonging to this Project.',
'doctype': u'DocField',
'fieldname': u'sb_tasks',
'fieldtype': u'Section Break',
'label': u'Tasks',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_tasks',
'fieldtype': u'HTML',
'label': u'Project Tasks',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break',
'label': u'Project Details',
'oldfieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'notes',
'fieldtype': u'Text Editor',
'label': u'Notes',
'no_copy': 0,
'oldfieldname': u'notes',
'oldfieldtype': u'Text Editor',
'permlevel': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_details',
'fieldtype': u'Section Break',
'label': u'Project Costing',
'oldfieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'project_value',
'fieldtype': u'Currency',
'label': u'Project Value',
'no_copy': 0,
'oldfieldname': u'project_value',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'est_material_cost',
'fieldtype': u'Currency',
'label': u'Estimated Material Cost',
'no_copy': 0,
'oldfieldname': u'est_material_cost',
'oldfieldtype': u'Currency',
'permlevel': 0,
'search_index': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'label': u'Margin',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'gross_margin_value',
'fieldtype': u'Currency',
'label': u'Gross Margin Value',
'no_copy': 0,
'oldfieldname': u'gross_margin_value',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'per_gross_margin',
'fieldtype': u'Currency',
'label': u'Gross Margin %',
'no_copy': 0,
'oldfieldname': u'per_gross_margin',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_details',
'fieldtype': u'Section Break',
'label': u'Customer Details',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Select name of Customer to whom project belongs',
'doctype': u'DocField',
'fieldname': u'customer',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Customer',
'no_copy': 0,
'oldfieldname': u'customer',
'oldfieldtype': u'Link',
'options': u'Customer',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'search_index': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_name',
'fieldtype': u'Data',
'in_filter': 1,
'label': u'Customer Name',
'no_copy': 0,
'oldfieldname': u'customer_name',
'oldfieldtype': u'Data',
'permlevel': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_address',
'fieldtype': u'Small Text',
'label': u'Customer Address',
'no_copy': 0,
'oldfieldname': u'customer_address',
'oldfieldtype': u'Small Text',
'permlevel': 1,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'contact_person',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Contact Person',
'no_copy': 0,
'oldfieldname': u'contact_person',
'oldfieldtype': u'Link',
'permlevel': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'territory',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Territory',
'oldfieldname': u'territory',
'oldfieldtype': u'Link',
'options': u'Territory',
'permlevel': 0,
'reqd': 0,
'search_index': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'contact_no',
'fieldtype': u'Data',
'label': u'Contact No',
'no_copy': 0,
'oldfieldname': u'contact_no',
'oldfieldtype': u'Data',
'permlevel': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'email_id',
'fieldtype': u'Data',
'label': u'Email Id',
'no_copy': 0,
'oldfieldname': u'email_id',
'oldfieldtype': u'Data',
'permlevel': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_group',
'fieldtype': u'Link',
'label': u'Customer Group',
'no_copy': 0,
'oldfieldname': u'customer_group',
'oldfieldtype': u'Link',
'options': u'Customer Group',
'permlevel': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'trash_reason',
'fieldtype': u'Small Text',
'hidden': 1,
'label': u'Trash Reason',
'no_copy': 0,
'oldfieldname': u'trash_reason',
'oldfieldtype': u'Small Text',
'permlevel': 0,
'print_hide': 1,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'file_list',
'fieldtype': u'Small Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1,
'search_index': 0
}
]

View File

@@ -0,0 +1,53 @@
// render
wn.doclistviews['Project'] = wn.views.ListView.extend({
init: function(d) {
this._super(d);
this.fields = this.fields.concat([
'`tabProject`.project_name',
'`tabProject`.status',
'`tabProject`.is_active',
'`tabProject`.priority',
'IFNULL(`tabProject`.project_value, 0) as project_value',
'IFNULL(`tabProject`.per_gross_margin, 0) as per_gross_margin',
'`tabProject`.creation',
]);
//this.stats = this.stats.concat(['company']);
},
prepare_data: function(data) {
this._super(data);
data.completion_date = wn.datetime.str_to_user(data.completion_date);
},
columns: [
{width: '3%', content: 'check'},
{width: '3%', content: 'docstatus'},
{width: '15%', content: 'name'},
{width: '22%', content: 'project_name+tags'},
{
width: '20%',
content: function(parent, data) {
$(parent).html(data.status + " [" + data.priority + "] "
+ (data.is_active=='No'?" [Inactive]":""));
},
},
{
width: '15%',
content: function(parent, data) {
$(parent).html(sys_defaults.currency + " "
+ fmt_money(data.project_value));
},
css: {'text-align': 'right'},
},
{
width: '10%',
content: function(parent, data) {
$(parent).html(fmt_money(data.per_gross_margin) + " %");
},
css: {'text-align': 'right'},
},
{
width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}
},
]
});