Merge branch '1209' of github.com:webnotes/erpnext into 1209

This commit is contained in:
Rushabh Mehta
2012-10-01 14:47:06 +05:30
62 changed files with 3553 additions and 2997 deletions

View File

@@ -31,9 +31,6 @@ 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
@@ -235,9 +232,6 @@ class DocType:
# delete gl entry
sql("delete from `tabGL Entry` where company = %s", self.doc.name)
#delete tabAccount Balance
sql("delete ab.* from `tabAccount Balance` ab, `tabAccount` a where ab.account = a.name and a.company = %s", self.doc.name)
#delete tabAccount
sql("delete from `tabAccount` where company = %s order by lft desc, rgt desc", self.doc.name)

View File

@@ -42,8 +42,8 @@ keydict = {
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
self.doc, self.doclist = d, dl
def on_update(self):
"""update defaults"""

View File

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

View File

@@ -1,26 +0,0 @@
// 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/>.
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}

View File

@@ -1,115 +0,0 @@
# DocType, Period
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:22',
'docstatus': 0,
'modified': '2012-03-27 14:36:22',
'modified_by': u'Administrator',
'owner': u'nabin@webnotestech.com'
},
# These values are common for all DocType
{
'autoname': u'field:period_name',
'colour': u'White:FFF',
'doctype': 'DocType',
'document_type': u'Master',
'in_create': 1,
'module': u'Setup',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'version': 5
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Period',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Period',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1,
'role': u'System Manager',
'write': 0
},
# DocType, Period
{
'doctype': 'DocType',
'name': u'Period'
},
# DocPerm
{
'doctype': u'DocPerm'
},
# DocPerm
{
'doctype': u'DocPerm'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'period_name',
'fieldtype': u'Data',
'label': u'Period Name',
'oldfieldname': u'period_name',
'oldfieldtype': u'Data'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'start_date',
'fieldtype': u'Date',
'label': u'Start Date',
'oldfieldname': u'start_date',
'oldfieldtype': u'Date'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'end_date',
'fieldtype': u'Date',
'label': u'End Date',
'oldfieldname': u'end_date',
'oldfieldtype': u'Date'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'period_type',
'fieldtype': u'Data',
'label': u'Period Type',
'oldfieldname': u'period_type',
'oldfieldtype': u'Data'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'fiscal_year',
'fieldtype': u'Data',
'label': u'Fiscal Year',
'oldfieldname': u'fiscal_year',
'oldfieldtype': u'Data'
}
]

View File

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

View File

@@ -1,78 +0,0 @@
# 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, 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, 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
# Generate Periods
#------------------
def generate_periods(self, fy):
ml = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
import webnotes.utils
from dateutil.relativedelta import relativedelta
if not sql("select name from `tabPeriod` where fiscal_year = '%s'" % fy):
ysd = sql("select year_start_date from `tabFiscal Year` where name = '%s'"%fy)[0][0]
#create period as fiscal year record name
#----------------------------------------------
arg = {'pn':fy,'sd':ysd,'ed':webnotes.utils.get_last_day(ysd + relativedelta(months=11)).strftime('%Y-%m-%d'),'pt':'Year','fy':fy}
self.create_period(arg)
for i in range(12):
msd = ysd + relativedelta(months=i)
arg = {'pn':ml[cint(msd.strftime('%m'))-1] + ' ' + msd.strftime('%Y'),'sd':msd.strftime('%Y-%m-%d'),'ed':webnotes.utils.get_last_day(msd).strftime('%Y-%m-%d'),'pt':'Month','fy':fy}
self.create_period(arg)
#---------------------------------------------------------
#create period common function
def create_period(self,arg):
p = Document('Period')
p.period_name = arg['pn']
p.start_date = arg['sd']
p.end_date = arg['ed']
p.period_type = arg['pt']
p.fiscal_year = arg['fy']
try:
p.save(1)
except NameError, e:
msgprint('Period %s already exists' % p.period_name)
raise Exception

View File

@@ -1,32 +0,0 @@
# DocType, Period Control
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:22',
'docstatus': 0,
'modified': '2012-03-27 14:36:22',
'modified_by': u'Administrator',
'owner': u'nabin@webnotestech.com'
},
# These values are common for all DocType
{
'colour': u'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'issingle': 1,
'module': u'Setup',
'name': '__common__',
'read_only': 1,
'section_style': u'Simple',
'server_code_error': u' ',
'version': 36
},
# DocType, Period Control
{
'doctype': 'DocType',
'name': u'Period Control'
}
]