mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 15:09:20 +00:00
moved directory structure
This commit is contained in:
1
setup/doctype/company/__init__.py
Normal file
1
setup/doctype/company/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
59
setup/doctype/company/company.js
Normal file
59
setup/doctype/company/company.js
Normal 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/>.
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
if(doc.abbr && !doc.__islocal) set_field_permlevel('abbr',1);
|
||||
}
|
||||
|
||||
cur_frm.cscript.has_special_chars = function(t) {
|
||||
var iChars = "!@#$%^*+=-[]\\\';,/{}|\":<>?";
|
||||
for (var i = 0; i < t.length; i++) {
|
||||
if (iChars.indexOf(t.charAt(i)) != -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cur_frm.cscript.company_name = function(doc){
|
||||
if(doc.company_name && cur_frm.cscript.has_special_chars(doc.company_name)){
|
||||
msgprint("<font color=red>Special Characters <b>! @ # $ % ^ * + = - [ ] ' ; , / { } | : < > ?</b> are not allowed for</font>\nCompany Name <b>" + doc.company_name +"</b>")
|
||||
doc.company_name = '';
|
||||
refresh_field('company_name');
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.abbr = function(doc){
|
||||
if(doc.abbr && cur_frm.cscript.has_special_chars(doc.abbr)){
|
||||
msgprint("<font color=red>Special Characters <b>! @ # $ % ^ * + = - [ ] ' ; , / { } | : < > ?</b> are not allowed for</font>\nAbbr <b>" + doc.abbr +"</b>")
|
||||
doc.abbr = '';
|
||||
refresh_field('abbr');
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.default_bank_account.get_query = function(doc) {
|
||||
return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict.receivables_group.get_query = function(doc) {
|
||||
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict.payables_group.get_query = function(doc) {
|
||||
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
|
||||
}
|
||||
262
setup/doctype/company/company.py
Normal file
262
setup/doctype/company/company.py
Normal file
@@ -0,0 +1,262 @@
|
||||
# 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,d,dl):
|
||||
self.doc, self.doclist = d,dl
|
||||
|
||||
def validate(self):
|
||||
if self.doc.fields.get('__islocal') and len(self.doc.abbr) > 5:
|
||||
webnotes.msgprint("Abbreviation cannot have more than 5 characters",
|
||||
raise_exception=1)
|
||||
|
||||
# Create default accounts
|
||||
# ---------------------------------------------------
|
||||
def create_default_accounts(self):
|
||||
self.fld_dict = {'account_name':0,'parent_account':1,'group_or_ledger':2,'is_pl_account':3,'account_type':4,'debit_or_credit':5,'company':6,'tax_rate':7}
|
||||
acc_list_common = [['Application of Funds (Assets)','','Group','No','','Debit',self.doc.name,''],
|
||||
['Current Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
|
||||
['Accounts Receivable','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Bank Accounts','Current Assets','Group','No','Bank or Cash','Debit',self.doc.name,''],
|
||||
['Cash In Hand','Current Assets','Group','No','Bank or Cash','Debit',self.doc.name,''],
|
||||
['Cash','Cash In Hand','Ledger','No','Bank or Cash','Debit',self.doc.name,''],
|
||||
['Loans and Advances (Assets)','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Securities and Deposits','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Earnest Money','Securities and Deposits','Ledger','No','','Debit',self.doc.name,''],
|
||||
['Stock In Hand','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Stock','Stock In Hand','Ledger','No','','Debit',self.doc.name,''],
|
||||
['Tax Assets','Current Assets','Group','No','','Debit',self.doc.name,''],
|
||||
['Fixed Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
|
||||
['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
|
||||
['Computers','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
|
||||
['Furniture and Fixture','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
|
||||
['Office Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
|
||||
['Plant and Machinery','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
|
||||
['Investments','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
|
||||
['Temporary Accounts (Assets)','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
|
||||
['Temporary Account (Assets)','Temporary Accounts (Assets)','Ledger','No','','Debit',self.doc.name,''],
|
||||
['Expenses','','Group','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Direct Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Cost of Goods Sold','Direct Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Indirect Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Advertising and Publicity','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
|
||||
['Bad Debts Written Off','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Bank Charges','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Books and Periodicals','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Charity and Donations','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Commission on Sales','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Conveyance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Customer Entertainment Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Depreciation Account','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Freight and Forwarding Charges','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
|
||||
['Legal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Miscellaneous Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
|
||||
['Office Maintenance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Office Rent','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Postal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Print and Stationary','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Rounded Off','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Salary','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Sales Promotion Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
|
||||
['Service Charges Paid','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Staff Welfare Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Telephone Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Travelling Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Water and Electricity Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
|
||||
['Income','','Group','Yes','','Credit',self.doc.name,''],
|
||||
['Direct Income','Income','Group','Yes','Income Account','Credit',self.doc.name,''],
|
||||
['Sales','Direct Income','Ledger','Yes','Income Account','Credit',self.doc.name,''],
|
||||
['Service','Direct Income','Ledger','Yes','Income Account','Credit',self.doc.name,''],
|
||||
['Indirect Income','Income','Group','Yes','Income Account','Credit',self.doc.name,''],
|
||||
['Source of Funds (Liabilities)','','Group','No','','Credit',self.doc.name,''],
|
||||
['Capital Account','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Reserves and Surplus','Capital Account','Group','No','','Credit',self.doc.name,''],
|
||||
['Shareholders Funds','Capital Account','Group','No','','Credit',self.doc.name,''],
|
||||
['Current Liabilities','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Accounts Payable','Current Liabilities','Group','No','','Credit',self.doc.name,''],
|
||||
['Duties and Taxes','Current Liabilities','Group','No','','Credit',self.doc.name,''],
|
||||
['Loans (Liabilities)','Current Liabilities','Group','No','','Credit',self.doc.name,''],
|
||||
['Secured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Unsecured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Bank Overdraft Account','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Temporary Accounts (Liabilities)','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
|
||||
['Temporary Account (Liabilities)','Temporary Accounts (Liabilities)','Ledger','No','','Credit',self.doc.name,'']
|
||||
]
|
||||
|
||||
acc_list_india = [
|
||||
['CENVAT Capital Goods','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
|
||||
['CENVAT','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
|
||||
['CENVAT Service Tax','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
|
||||
['CENVAT Service Tax Cess 1','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
|
||||
['CENVAT Service Tax Cess 2','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
|
||||
['CENVAT Edu Cess','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
|
||||
['CENVAT SHE Cess','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
|
||||
['Excise Duty 4','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'4.00'],
|
||||
['Excise Duty 8','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'8.00'],
|
||||
['Excise Duty 10','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'10.00'],
|
||||
['Excise Duty 14','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'14.00'],
|
||||
['Excise Duty Edu Cess 2','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'2.00'],
|
||||
['Excise Duty SHE Cess 1','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'1.00'],
|
||||
['P L A','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
|
||||
['P L A - Cess Portion','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
|
||||
['Edu. Cess on Excise','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
|
||||
['Edu. Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
|
||||
['Edu. Cess on TDS','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
|
||||
['Excise Duty @ 4','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'4.00'],
|
||||
['Excise Duty @ 8','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'8.00'],
|
||||
['Excise Duty @ 10','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'10.00'],
|
||||
['Excise Duty @ 14','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'14.00'],
|
||||
['Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'10.3'],
|
||||
['SHE Cess on Excise','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
|
||||
['SHE Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
|
||||
['SHE Cess on TDS','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
|
||||
['Professional Tax','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
|
||||
['VAT','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
|
||||
['TDS (Advertisement)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
|
||||
['TDS (Commission)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
|
||||
['TDS (Contractor)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
|
||||
['TDS (Interest)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
|
||||
['TDS (Rent)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,''],
|
||||
['TDS (Salary)','Duties and Taxes','Ledger','No','Chargeable','Credit',self.doc.name,'']
|
||||
]
|
||||
# load common account heads
|
||||
for d in acc_list_common:
|
||||
self.add_acc(d)
|
||||
|
||||
country = sql("select value from tabSingles where field = 'country' and doctype = 'Control Panel'")
|
||||
country = country and cstr(country[0][0]) or ''
|
||||
|
||||
# load taxes (only for India)
|
||||
if country == 'India':
|
||||
for d in acc_list_india:
|
||||
self.add_acc(d)
|
||||
|
||||
# Create account
|
||||
# ---------------------------------------------------
|
||||
def add_acc(self,lst):
|
||||
ac = Document('Account')
|
||||
for d in self.fld_dict.keys():
|
||||
ac.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]]
|
||||
ac.old_parent = ''
|
||||
ac_obj = get_obj(doc=ac)
|
||||
ac_obj.doc.freeze_account='No'
|
||||
ac_obj.doc.master_type = ''
|
||||
ac_obj.validate()
|
||||
ac_obj.doc.save(1)
|
||||
ac_obj.on_update()
|
||||
sql("commit")
|
||||
sql("start transaction")
|
||||
|
||||
|
||||
# Set letter head
|
||||
# ---------------------------------------------------
|
||||
def set_letter_head(self):
|
||||
if not self.doc.letter_head:
|
||||
if self.doc.address:
|
||||
header = """
|
||||
<div><h3> %(comp)s </h3> %(add)s </div>
|
||||
|
||||
""" % {'comp':self.doc.name,
|
||||
'add':self.doc.address.replace("\n",'<br>')}
|
||||
|
||||
self.doc.letter_head = header
|
||||
|
||||
# Set default AR and AP group
|
||||
# ---------------------------------------------------
|
||||
def set_default_groups(self):
|
||||
if not self.doc.receivables_group:
|
||||
set(self.doc, 'receivables_group', 'Accounts Receivable - '+self.doc.abbr)
|
||||
if not self.doc.payables_group:
|
||||
set(self.doc, 'payables_group', 'Accounts Payable - '+self.doc.abbr)
|
||||
|
||||
|
||||
# Create default cost center
|
||||
# ---------------------------------------------------
|
||||
def create_default_cost_center(self):
|
||||
glc = get_obj('GL Control')
|
||||
cc_list = [{'cost_center_name':'Root','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Group','parent_cost_center':'','old_parent':''}, {'cost_center_name':'Default CC Ledger','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Ledger','parent_cost_center':'Root - ' + self.doc.abbr,'old_parent':''}]
|
||||
for c in cc_list:
|
||||
glc.add_cc(str(c))
|
||||
|
||||
|
||||
# On update
|
||||
# ---------------------------------------------------
|
||||
def on_update(self):
|
||||
self.set_letter_head()
|
||||
ac = sql("select name from tabAccount where account_name='Income' and company=%s", self.doc.name)
|
||||
if not ac:
|
||||
self.create_default_accounts()
|
||||
self.set_default_groups()
|
||||
cc = sql("select name from `tabCost Center` where cost_center_name = 'Root' and company_name = '%s'"%(self.doc.name))
|
||||
if not cc:
|
||||
self.create_default_cost_center()
|
||||
|
||||
#
|
||||
# ---------------------------------------------------
|
||||
def on_trash(self):
|
||||
"""
|
||||
Trash accounts and cost centers for this company if no gl entry exists
|
||||
"""
|
||||
rec = sql("SELECT name from `tabGL Entry` where ifnull(is_cancelled, 'No') = 'No' and company = %s", self.doc.name)
|
||||
if not rec:
|
||||
# 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)
|
||||
|
||||
#delete cost center child table - budget detail
|
||||
sql("delete bd.* from `tabBudget Detail` bd, `tabCost Center` cc where bd.parent = cc.name and cc.company_name = %s", self.doc.name)
|
||||
#delete cost center
|
||||
sql("delete from `tabCost Center` WHERE company_name = %s order by lft desc, rgt desc", self.doc.name)
|
||||
|
||||
#update value as blank for tabDefaultValue defkey=company
|
||||
sql("update `tabDefaultValue` set defvalue = '' where defkey='company' and defvalue = %s", self.doc.name)
|
||||
|
||||
#update value as blank for tabSingles Global Defaults
|
||||
sql("update `tabSingles` set value = '' where doctype='Global Defaults' and field = 'default_company' and value = %s", self.doc.name)
|
||||
|
||||
|
||||
# on rename
|
||||
# ---------
|
||||
def on_rename(self,newdn,olddn):
|
||||
sql("update `tabCompany` set company_name = '%s' where name = '%s'" %(newdn,olddn))
|
||||
sql("update `tabSingles` set value = %s where doctype='Global Defaults' and field = 'default_company' and value = %s", (newdn, olddn))
|
||||
if get_defaults('company') == olddn:
|
||||
set_default('company', newdn)
|
||||
377
setup/doctype/company/company.txt
Normal file
377
setup/doctype/company/company.txt
Normal file
@@ -0,0 +1,377 @@
|
||||
# DocType, Company
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-05-15 12:15:00',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-08-10 12:15:45',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': u'1323855292',
|
||||
'allow_trash': 1,
|
||||
'autoname': u'field:company_name',
|
||||
'colour': u'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': u'Master',
|
||||
'module': u'Setup',
|
||||
'name': '__common__',
|
||||
'section_style': u'Tabbed',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': u'Company',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': u'Company',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Company
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'Company'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'System Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'System Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'All'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'details',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Company Details',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'company_name',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Company',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': u'company_name',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'cb0',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'abbr',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Abbr',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': u'abbr',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'default_settings',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Default Settings',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'default_currency',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Default Currency',
|
||||
'options': u'link:Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:!doc.__islocal',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'default_bank_account',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Default Bank Account',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': u'default_bank_account',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Account',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:!doc.__islocal',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'receivables_group',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Receivables Group',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': u'receivables_group',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Account',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:!doc.__islocal',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'payables_group',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Payables Group',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': u'payables_group',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Account',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break0',
|
||||
'fieldtype': u'Column Break',
|
||||
'oldfieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:!doc.__islocal',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'credit_days',
|
||||
'fieldtype': u'Int',
|
||||
'label': u'Credit Days',
|
||||
'oldfieldname': u'credit_days',
|
||||
'oldfieldtype': u'Int',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:!doc.__islocal',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'credit_limit',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Credit Limit',
|
||||
'oldfieldname': u'credit_limit',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'depends_on': u'eval:!doc.__islocal',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'yearly_bgt_flag',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'If Yearly Budget Exceeded',
|
||||
'oldfieldname': u'yearly_bgt_flag',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nWarn\nIgnore\nStop',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'depends_on': u'eval:!doc.__islocal',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'monthly_bgt_flag',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'If Monthly Budget Exceeded',
|
||||
'oldfieldname': u'monthly_bgt_flag',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nWarn\nIgnore\nStop',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'For reference only.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'company_info',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Company Info',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'address',
|
||||
'fieldtype': u'Small Text',
|
||||
'label': u'Address',
|
||||
'oldfieldname': u'address',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break1',
|
||||
'fieldtype': u'Column Break',
|
||||
'oldfieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'phone_no',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Phone No',
|
||||
'oldfieldname': u'phone_no',
|
||||
'oldfieldtype': u'Data',
|
||||
'options': u'Phone',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'fax',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Fax',
|
||||
'oldfieldname': u'fax',
|
||||
'oldfieldtype': u'Data',
|
||||
'options': u'Phone',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'email',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Email',
|
||||
'oldfieldname': u'email',
|
||||
'oldfieldtype': u'Data',
|
||||
'options': u'Email',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'website',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Website',
|
||||
'oldfieldname': u'website',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Company registration numbers for your reference. Example: VAT Registration Numbers etc.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'registration_info',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Registration Info',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Company registration numbers for your reference. Tax numbers etc.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'registration_details',
|
||||
'fieldtype': u'Code',
|
||||
'label': u'Registration Details',
|
||||
'oldfieldname': u'registration_details',
|
||||
'oldfieldtype': u'Code',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'trash_reason',
|
||||
'fieldtype': u'Small Text',
|
||||
'label': u'Trash Reason',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': u'trash_reason',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user