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,39 @@
// 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/>.
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 ='';
}

View File

@@ -0,0 +1,59 @@
# 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, set_default, str_esc_quote, user_format, validate_email_add
from webnotes.utils.email_lib import sendmail
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
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 validate(self):
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

View File

@@ -0,0 +1,315 @@
# DocType, Task
[
# These values are common in all dictionaries
{
u'creation': '2012-08-08 15:39:55',
u'docstatus': 0,
u'modified': '2012-09-17 10:58:32',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1324880734',
'allow_trash': 1,
'autoname': u'TASK.#####',
'colour': u'White:FFF',
'default_print_format': u'Standard',
u'doctype': u'DocType',
'document_type': u'Master',
'module': u'Projects',
u'name': u'__common__',
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'%(subject)s',
'tag_fields': u'status',
'version': 1
},
# These values are common for all DocField
{
u'doctype': u'DocField',
u'name': u'__common__',
'parent': u'Task',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
u'doctype': u'DocPerm',
u'name': u'__common__',
'parent': u'Task',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'role': u'Projects User'
},
# DocType, Task
{
u'doctype': u'DocType',
u'name': u'Task'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'task_details',
'fieldtype': u'Section Break',
'label': u'Task Details',
'oldfieldtype': u'Section Break',
'search_index': 0,
'width': u'50%'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'subject',
'fieldtype': u'Data',
'in_filter': 1,
'label': u'Subject',
'oldfieldname': u'subject',
'oldfieldtype': u'Data',
'reqd': 1
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'exp_start_date',
'fieldtype': u'Date',
'label': u'Expected Start Date',
'oldfieldname': u'exp_start_date',
'oldfieldtype': u'Date',
'reqd': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'exp_end_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Expected End Date',
'oldfieldname': u'exp_end_date',
'oldfieldtype': u'Date',
'reqd': 0,
'search_index': 1
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'project',
'fieldtype': u'Link',
'label': u'Project',
'oldfieldname': u'project',
'oldfieldtype': u'Link',
'options': u'Project',
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
u'doctype': u'DocField',
'fieldname': u'status',
'fieldtype': u'Select',
'label': u'Status',
'no_copy': 1,
'oldfieldname': u'status',
'oldfieldtype': u'Select',
'options': u'Open\nWorking\nPending Review\nClosed\nCancelled',
'trigger': u'Client'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'priority',
'fieldtype': u'Select',
'in_filter': 1,
'label': u'Priority',
'oldfieldname': u'priority',
'oldfieldtype': u'Select',
'options': u'Low\nMedium\nHigh\nUrgent',
'reqd': 0,
'search_index': 1
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'section_break0',
'fieldtype': u'Section Break',
'oldfieldtype': u'Section Break',
'options': u'Simple'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'description',
'fieldtype': u'Text Editor',
'label': u'Details',
'oldfieldname': u'description',
'oldfieldtype': u'Text Editor',
'reqd': 0,
'width': u'300px'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'time_and_budget',
'fieldtype': u'Section Break',
'label': u'Time and Budget',
'oldfieldtype': u'Section Break'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'expected',
'fieldtype': u'Column Break',
'label': u'Expected',
'oldfieldtype': u'Column Break',
'width': u'50%'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'exp_total_hrs',
'fieldtype': u'Data',
'label': u'Total Hours (Expected)',
'oldfieldname': u'exp_total_hrs',
'oldfieldtype': u'Data',
'reqd': 0
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'allocated_budget',
'fieldtype': u'Currency',
'label': u'Allocated Budget',
'oldfieldname': u'allocated_budget',
'oldfieldtype': u'Currency'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'actual',
'fieldtype': u'Column Break',
'label': u'Actual',
'oldfieldtype': u'Column Break',
'width': u'50%'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'act_start_date',
'fieldtype': u'Date',
'label': u'Actual Start Date',
'oldfieldname': u'act_start_date',
'oldfieldtype': u'Date'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'act_end_date',
'fieldtype': u'Date',
'label': u'Actual End Date',
'oldfieldname': u'act_end_date',
'oldfieldtype': u'Date'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'act_total_hrs',
'fieldtype': u'Data',
'label': u'Total Hours (Actual)',
'oldfieldname': u'act_total_hrs',
'oldfieldtype': u'Data'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'actual_budget',
'fieldtype': u'Currency',
'label': u'Actual Budget',
'oldfieldname': u'actual_budget',
'oldfieldtype': u'Currency'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'more_details',
'fieldtype': u'Section Break',
'label': u'More Details'
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.status == "Closed" || doc.status == "Pending Review"',
u'doctype': u'DocField',
'fieldname': u'review_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Review Date',
'oldfieldname': u'review_date',
'oldfieldtype': u'Date'
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.status == "Closed"',
u'doctype': u'DocField',
'fieldname': u'closing_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Closing Date',
'oldfieldname': u'closing_date',
'oldfieldtype': u'Date'
},
# DocPerm
{
'cancel': 1,
'create': 1,
u'doctype': u'DocPerm',
'permlevel': 0,
'write': 1
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 1
}
]

View File

@@ -0,0 +1,38 @@
// render
wn.doclistviews['Task'] = wn.views.ListView.extend({
init: function(d) {
this._super(d);
this.fields = this.fields.concat([
'`tabTask`.subject',
'`tabTask`.status',
'`tabTask`.opening_date',
'`tabTask`.priority',
'`tabTask`.allocated_to',
]);
},
prepare_data: function(data) {
this._super(data);
data.opening_date = wn.datetime.str_to_user(data.opening_date);
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content: 'avatar'},
{width: '3%', content: 'docstatus'},
{width: '12%', content: 'name'},
{width: '30%', content: 'subject+tags'},
{
width: '15%',
content: function(parent, data) {
$(parent).html(data.status +
(data.priority ? " [" + data.priority + "]" : "")
);
},
},
{width: '20%', content: 'allocated_to'},
{width: '12%', content:'opening_date', css: {
'text-align': 'right', 'color':'#777'
}},
]
});