cleaned up sample website and separated fixtures by country
This commit is contained in:
parent
169c1fd93b
commit
370a024e46
0
erpnext/setup/doctype/company/.txt
Normal file
0
erpnext/setup/doctype/company/.txt
Normal file
@ -2,7 +2,7 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import frappe, os
|
||||
from frappe import _
|
||||
|
||||
from frappe.utils import cint
|
||||
@ -12,8 +12,6 @@ import frappe.defaults
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Company(Document):
|
||||
|
||||
|
||||
def onload(self):
|
||||
self.set("__transactions_exist", self.check_if_transactions_exist())
|
||||
|
||||
@ -43,7 +41,7 @@ class Company(Document):
|
||||
where company=%s and docstatus<2 limit 1""", self.name):
|
||||
self.create_default_accounts()
|
||||
self.create_default_warehouses()
|
||||
self.create_default_web_page()
|
||||
self.install_country_fixtures()
|
||||
|
||||
if not frappe.db.get_value("Cost Center", {"group_or_ledger": "Ledger",
|
||||
"company": self.name}):
|
||||
@ -54,8 +52,12 @@ class Company(Document):
|
||||
if self.default_currency:
|
||||
frappe.db.set_value("Currency", self.default_currency, "enabled", 1)
|
||||
|
||||
def install_country_fixtures(self):
|
||||
if os.path.exists(os.path.join(os.path.dirname(__file__), "fixtures", self.country.lower())):
|
||||
frappe.get_attr("erpnext.setup.doctype.company.fixtures.{0}.install".format(self.country.lower()))(self)
|
||||
|
||||
def create_default_warehouses(self):
|
||||
for whname in ("Stores", "Work In Progress", "Finished Goods"):
|
||||
for whname in (_("Stores"), _("Work In Progress"), _("Finished Goods")):
|
||||
if not frappe.db.exists("Warehouse", whname + " - " + self.abbr):
|
||||
stock_group = frappe.db.get_value("Account", {"account_type": "Stock",
|
||||
"group_or_ledger": "Group"})
|
||||
@ -67,47 +69,13 @@ class Company(Document):
|
||||
"create_account_under": stock_group
|
||||
}).insert()
|
||||
|
||||
def create_default_web_page(self):
|
||||
if not frappe.db.get_value("Website Settings", None, "home_page") and \
|
||||
not frappe.db.sql("select name from tabCompany where name!=%s", self.name):
|
||||
import os
|
||||
with open(os.path.join(os.path.dirname(__file__), "sample_home_page.html"), "r") as webfile:
|
||||
webpage = frappe.get_doc({
|
||||
"doctype": "Web Page",
|
||||
"title": self.name + " Home",
|
||||
"published": 1,
|
||||
"description": "Standard Home Page for " + self.name,
|
||||
"main_section": webfile.read() % self.as_dict()
|
||||
}).insert()
|
||||
|
||||
# update in home page in settings
|
||||
website_settings = frappe.get_doc("Website Settings", "Website Settings")
|
||||
website_settings.home_page = webpage.name
|
||||
website_settings.brand_html = self.name
|
||||
website_settings.copyright = self.name
|
||||
website_settings.append("top_bar_items", {
|
||||
"doctype": "Top Bar Item",
|
||||
"label":"Contact",
|
||||
"url": "contact"
|
||||
})
|
||||
website_settings.append("top_bar_items", {
|
||||
"doctype": "Top Bar Item",
|
||||
"label":"Blog",
|
||||
"url": "blog"
|
||||
})
|
||||
website_settings.save()
|
||||
style_settings = frappe.get_doc("Style Settings", "Style Settings")
|
||||
style_settings.top_bar_background = "F2F2F2"
|
||||
style_settings.font_size = "15px"
|
||||
style_settings.save()
|
||||
|
||||
def create_default_accounts(self):
|
||||
if self.chart_of_accounts:
|
||||
self.import_chart_of_account()
|
||||
else:
|
||||
self.create_standard_accounts()
|
||||
frappe.db.set(self, "receivables_group", "Accounts Receivable - " + self.abbr)
|
||||
frappe.db.set(self, "payables_group", "Accounts Payable - " + self.abbr)
|
||||
frappe.db.set(self, "receivables_group", _("Accounts Receivable") + " - " + self.abbr)
|
||||
frappe.db.set(self, "payables_group", _("Accounts Payable") + " - " + self.abbr)
|
||||
|
||||
def import_chart_of_account(self):
|
||||
chart = frappe.get_doc("Chart of Accounts", self.chart_of_accounts)
|
||||
@ -134,15 +102,15 @@ class Company(Document):
|
||||
frappe.db.set(self, field, account)
|
||||
|
||||
_set_default_accounts({
|
||||
"default_cash_account": "Cash",
|
||||
"default_bank_account": "Bank"
|
||||
"default_cash_account": _("Cash"),
|
||||
"default_bank_account": _("Bank")
|
||||
})
|
||||
|
||||
if cint(frappe.db.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
|
||||
_set_default_accounts({
|
||||
"stock_received_but_not_billed": "Stock Received But Not Billed",
|
||||
"stock_adjustment_account": "Stock Adjustment",
|
||||
"expenses_included_in_valuation": "Expenses Included In Valuation"
|
||||
"stock_received_but_not_billed": _("Stock Received But Not Billed"),
|
||||
"stock_adjustment_account": _("Stock Adjustment"),
|
||||
"expenses_included_in_valuation": _("Expenses Included In Valuation")
|
||||
})
|
||||
|
||||
def create_default_cost_center(self):
|
||||
@ -154,7 +122,7 @@ class Company(Document):
|
||||
'parent_cost_center':''
|
||||
},
|
||||
{
|
||||
'cost_center_name':'Main',
|
||||
'cost_center_name':_('Main'),
|
||||
'company':self.name,
|
||||
'group_or_ledger':'Ledger',
|
||||
'parent_cost_center':self.name + ' - ' + self.abbr
|
||||
@ -218,126 +186,78 @@ class Company(Document):
|
||||
}
|
||||
|
||||
acc_list_common = [
|
||||
['Application of Funds (Assets)','','Group','','Balance Sheet',self.name,''],
|
||||
['Current Assets','Application of Funds (Assets)','Group','','Balance Sheet',self.name,''],
|
||||
['Accounts Receivable','Current Assets','Group','','Balance Sheet',self.name,''],
|
||||
['Bank Accounts','Current Assets','Group','Bank','Balance Sheet',self.name,''],
|
||||
['Cash In Hand','Current Assets','Group','Cash','Balance Sheet',self.name,''],
|
||||
['Cash','Cash In Hand','Ledger','Cash','Balance Sheet',self.name,''],
|
||||
['Loans and Advances (Assets)','Current Assets','Group','','Balance Sheet',self.name,''],
|
||||
['Securities and Deposits','Current Assets','Group','','Balance Sheet',self.name,''],
|
||||
['Earnest Money','Securities and Deposits','Ledger','','Balance Sheet',self.name,''],
|
||||
['Stock Assets','Current Assets','Group','Stock','Balance Sheet',self.name,''],
|
||||
['Tax Assets','Current Assets','Group','','Balance Sheet',self.name,''],
|
||||
['Fixed Assets','Application of Funds (Assets)','Group','','Balance Sheet',self.name,''],
|
||||
['Capital Equipments','Fixed Assets','Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
['Computers','Fixed Assets','Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
['Furniture and Fixture','Fixed Assets','Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
['Office Equipments','Fixed Assets','Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
['Plant and Machinery','Fixed Assets','Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
['Investments','Application of Funds (Assets)','Group','','Balance Sheet',self.name,''],
|
||||
['Temporary Accounts (Assets)','Application of Funds (Assets)','Group','','Balance Sheet',self.name,''],
|
||||
['Temporary Account (Assets)','Temporary Accounts (Assets)','Ledger','','Balance Sheet',self.name,''],
|
||||
['Expenses','','Group','Expense Account','Profit and Loss',self.name,''],
|
||||
['Direct Expenses','Expenses','Group','Expense Account','Profit and Loss',self.name,''],
|
||||
['Stock Expenses','Direct Expenses','Group','Expense Account','Profit and Loss',self.name,''],
|
||||
['Cost of Goods Sold','Stock Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Stock Adjustment','Stock Expenses','Ledger','Stock Adjustment','Profit and Loss',self.name,''],
|
||||
['Expenses Included In Valuation', "Stock Expenses", 'Ledger', 'Expenses Included In Valuation', 'Profit and Loss', self.name, ''],
|
||||
['Indirect Expenses','Expenses','Group','Expense Account','Profit and Loss',self.name,''],
|
||||
['Advertising and Publicity','Indirect Expenses','Ledger','Chargeable','Profit and Loss',self.name,''],
|
||||
['Bad Debts Written Off','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Bank Charges','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Books and Periodicals','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Charity and Donations','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Commission on Sales','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Conveyance Expenses','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Customer Entertainment Expenses','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Depreciation Account','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Freight and Forwarding Charges','Indirect Expenses','Ledger','Chargeable','Profit and Loss',self.name,''],
|
||||
['Legal Expenses','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Miscellaneous Expenses','Indirect Expenses','Ledger','Chargeable','Profit and Loss',self.name,''],
|
||||
['Office Maintenance Expenses','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Office Rent','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Postal Expenses','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Print and Stationary','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Rounded Off','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Salary','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Sales Promotion Expenses','Indirect Expenses','Ledger','Chargeable','Profit and Loss',self.name,''],
|
||||
['Service Charges Paid','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Staff Welfare Expenses','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Telephone Expenses','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Travelling Expenses','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Water and Electricity Expenses','Indirect Expenses','Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
['Income','','Group','','Profit and Loss',self.name,''],
|
||||
['Direct Income','Income','Group','Income Account','Profit and Loss',self.name,''],
|
||||
['Sales','Direct Income','Ledger','Income Account','Profit and Loss',self.name,''],
|
||||
['Service','Direct Income','Ledger','Income Account','Profit and Loss',self.name,''],
|
||||
['Indirect Income','Income','Group','Income Account','Profit and Loss',self.name,''],
|
||||
['Source of Funds (Liabilities)','','Group','','Balance Sheet',self.name,''],
|
||||
['Capital Account','Source of Funds (Liabilities)','Group','','Balance Sheet',self.name,''],
|
||||
['Reserves and Surplus','Capital Account','Ledger','','Balance Sheet',self.name,''],
|
||||
['Shareholders Funds','Capital Account','Ledger','','Balance Sheet',self.name,''],
|
||||
['Current Liabilities','Source of Funds (Liabilities)','Group','','Balance Sheet',self.name,''],
|
||||
['Accounts Payable','Current Liabilities','Group','','Balance Sheet',self.name,''],
|
||||
['Stock Liabilities','Current Liabilities','Group','','Balance Sheet',self.name,''],
|
||||
['Stock Received But Not Billed', 'Stock Liabilities', 'Ledger', 'Stock Received But Not Billed', 'Balance Sheet', self.name, ''],
|
||||
['Duties and Taxes','Current Liabilities','Group','','Balance Sheet',self.name,''],
|
||||
['Loans (Liabilities)','Current Liabilities','Group','','Balance Sheet',self.name,''],
|
||||
['Secured Loans','Loans (Liabilities)','Group','','Balance Sheet',self.name,''],
|
||||
['Unsecured Loans','Loans (Liabilities)','Group','','Balance Sheet',self.name,''],
|
||||
['Bank Overdraft Account','Loans (Liabilities)','Group','','Balance Sheet',self.name,''],
|
||||
['Temporary Accounts (Liabilities)','Source of Funds (Liabilities)','Group','','Balance Sheet',self.name,''],
|
||||
['Temporary Account (Liabilities)','Temporary Accounts (Liabilities)','Ledger','','Balance Sheet',self.name,'']
|
||||
[_('Application of Funds (Assets)'),'','Group','','Balance Sheet',self.name,''],
|
||||
[_('Current Assets'),_('Application of Funds (Assets)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Accounts Receivable'),_('Current Assets'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Bank Accounts'),_('Current Assets'),'Group','Bank','Balance Sheet',self.name,''],
|
||||
[_('Cash In Hand'),_('Current Assets'),'Group','Cash','Balance Sheet',self.name,''],
|
||||
[_('Cash'),_('Cash In Hand'),'Ledger','Cash','Balance Sheet',self.name,''],
|
||||
[_('Loans and Advances (Assets)'),_('Current Assets'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Securities and Deposits'),_('Current Assets'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Earnest Money'),_('Securities and Deposits'),'Ledger','','Balance Sheet',self.name,''],
|
||||
[_('Stock Assets'),_('Current Assets'),'Group','Stock','Balance Sheet',self.name,''],
|
||||
[_('Tax Assets'),_('Current Assets'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Fixed Assets'),_('Application of Funds (Assets)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Capital Equipments'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
[_('Computers'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
[_('Furniture and Fixture'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
[_('Office Equipments'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
[_('Plant and Machinery'),_('Fixed Assets'),'Ledger','Fixed Asset','Balance Sheet',self.name,''],
|
||||
[_('Investments'),_('Application of Funds (Assets)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Temporary Accounts (Assets)'),_('Application of Funds (Assets)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Temporary Account (Assets)'),_('Temporary Accounts (Assets)'),'Ledger','','Balance Sheet',self.name,''],
|
||||
[_('Expenses'),'','Group','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Direct Expenses'),_('Expenses'),'Group','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Stock Expenses'),_('Direct Expenses'),'Group','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Cost of Goods Sold'),_('Stock Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Stock Adjustment'),_('Stock Expenses'),'Ledger','Stock Adjustment','Profit and Loss',self.name,''],
|
||||
[_('Expenses Included In Valuation'), _("Stock Expenses"), 'Ledger', 'Expenses Included In Valuation', 'Profit and Loss', self.name, ''],
|
||||
[_('Indirect Expenses'), _('Expenses'),'Group','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Marketing Expenses'), _('Indirect Expenses'),'Ledger','Chargeable','Profit and Loss',self.name,''],
|
||||
[_('Sales Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Administrative Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Charity and Donations'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Commission on Sales'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Travel Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Entertainment Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Depreciation'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Freight and Forwarding Charges'), _('Indirect Expenses'),'Ledger','Chargeable','Profit and Loss',self.name,''],
|
||||
[_('Legal Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Miscellaneous Expenses'), _('Indirect Expenses'),'Ledger','Chargeable','Profit and Loss',self.name,''],
|
||||
[_('Office Maintenance Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Office Rent'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Postal Expenses'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Print and Stationary'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Rounded Off'), _('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Salary') ,_('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Telephone Expenses') ,_('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Utility Expenses') ,_('Indirect Expenses'),'Ledger','Expense Account','Profit and Loss',self.name,''],
|
||||
[_('Income'),'','Group','','Profit and Loss',self.name,''],
|
||||
[_('Direct Income'),_('Income'),'Group','Income Account','Profit and Loss',self.name,''],
|
||||
[_('Sales'),_('Direct Income'),'Ledger','Income Account','Profit and Loss',self.name,''],
|
||||
[_('Service'),_('Direct Income'),'Ledger','Income Account','Profit and Loss',self.name,''],
|
||||
[_('Indirect Income'),_('Income'),'Group','Income Account','Profit and Loss',self.name,''],
|
||||
[_('Source of Funds (Liabilities)'),'','Group','','Balance Sheet',self.name,''],
|
||||
[_('Capital Account'),_('Source of Funds (Liabilities)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Reserves and Surplus'),_('Capital Account'),'Ledger','','Balance Sheet',self.name,''],
|
||||
[_('Shareholders Funds'),_('Capital Account'),'Ledger','','Balance Sheet',self.name,''],
|
||||
[_('Current Liabilities'),_('Source of Funds (Liabilities)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Accounts Payable'),'Current Liabilities','Group','','Balance Sheet',self.name,''],
|
||||
[_('Stock Liabilities'),'Current Liabilities','Group','','Balance Sheet',self.name,''],
|
||||
[_('Stock Received But Not Billed'), _('Stock Liabilities'), 'Ledger', 'Stock Received But Not Billed', 'Balance Sheet', self.name, ''],
|
||||
[_('Duties and Taxes'),_('Current Liabilities'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Loans (Liabilities)'),'Current Liabilities','Group','','Balance Sheet',self.name,''],
|
||||
[_('Secured Loans'),_('Loans (Liabilities)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Unsecured Loans'),_('Loans (Liabilities)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Bank Overdraft Account'),_('Loans (Liabilities)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Temporary Accounts (Liabilities)'),_('Source of Funds (Liabilities)'),'Group','','Balance Sheet',self.name,''],
|
||||
[_('Temporary Account (Liabilities)'),_('Temporary Accounts (Liabilities)'),'Ledger','','Balance Sheet',self.name,'']
|
||||
]
|
||||
|
||||
acc_list_india = [
|
||||
['CENVAT Capital Goods','Tax Assets','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['CENVAT','Tax Assets','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['CENVAT Service Tax','Tax Assets','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['CENVAT Service Tax Cess 1','Tax Assets','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['CENVAT Service Tax Cess 2','Tax Assets','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['CENVAT Edu Cess','Tax Assets','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['CENVAT SHE Cess','Tax Assets','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['Excise Duty 4','Tax Assets','Ledger','Tax','Balance Sheet',self.name,'4.00'],
|
||||
['Excise Duty 8','Tax Assets','Ledger','Tax','Balance Sheet',self.name,'8.00'],
|
||||
['Excise Duty 10','Tax Assets','Ledger','Tax','Balance Sheet',self.name,'10.00'],
|
||||
['Excise Duty 14','Tax Assets','Ledger','Tax','Balance Sheet',self.name,'14.00'],
|
||||
['Excise Duty Edu Cess 2','Tax Assets','Ledger','Tax','Balance Sheet',self.name,'2.00'],
|
||||
['Excise Duty SHE Cess 1','Tax Assets','Ledger','Tax','Balance Sheet',self.name,'1.00'],
|
||||
['P L A','Tax Assets','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['P L A - Cess Portion','Tax Assets','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['Edu. Cess on Excise','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'2.00'],
|
||||
['Edu. Cess on Service Tax','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'2.00'],
|
||||
['Edu. Cess on TDS','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'2.00'],
|
||||
['Excise Duty @ 4','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'4.00'],
|
||||
['Excise Duty @ 8','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'8.00'],
|
||||
['Excise Duty @ 10','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'10.00'],
|
||||
['Excise Duty @ 14','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'14.00'],
|
||||
['Service Tax','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'10.3'],
|
||||
['SHE Cess on Excise','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'1.00'],
|
||||
['SHE Cess on Service Tax','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'1.00'],
|
||||
['SHE Cess on TDS','Duties and Taxes','Ledger','Tax','Balance Sheet',self.name,'1.00'],
|
||||
['Professional Tax','Duties and Taxes','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['VAT','Duties and Taxes','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['TDS (Advertisement)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['TDS (Commission)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['TDS (Contractor)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['TDS (Interest)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['TDS (Rent)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',self.name,''],
|
||||
['TDS (Salary)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',self.name,'']
|
||||
]
|
||||
# load common account heads
|
||||
for d in acc_list_common:
|
||||
self.add_acc(d)
|
||||
|
||||
country = frappe.db.get_default("country")
|
||||
|
||||
# load taxes (only for India)
|
||||
if country == 'India':
|
||||
for d in acc_list_india:
|
||||
self.add_acc(d)
|
||||
|
||||
@frappe.whitelist()
|
||||
def replace_abbr(company, old, new):
|
||||
frappe.db.set_value("Company", company, "abbr", new)
|
||||
|
0
erpnext/setup/doctype/company/fixtures/__init__.py
Normal file
0
erpnext/setup/doctype/company/fixtures/__init__.py
Normal file
81
erpnext/setup/doctype/company/fixtures/india/__init__.py
Normal file
81
erpnext/setup/doctype/company/fixtures/india/__init__.py
Normal file
@ -0,0 +1,81 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
|
||||
def install(company):
|
||||
docs = [
|
||||
{'doctype': 'Deduction Type', 'name': 'Professional Tax', 'description': 'Professional Tax', 'deduction_name': 'Professional Tax'},
|
||||
{'doctype': 'Deduction Type', 'name': 'Provident Fund', 'description': 'Provident fund', 'deduction_name': 'Provident Fund'},
|
||||
{'doctype': 'Earning Type', 'name': 'House Rent Allowance', 'description': 'House Rent Allowance', 'earning_name': 'House Rent Allowance', 'taxable': 'No'},
|
||||
]
|
||||
|
||||
for d in docs:
|
||||
try:
|
||||
frappe.get_doc(d).insert()
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
|
||||
# accounts
|
||||
|
||||
fld_dict = {
|
||||
'account_name': 0,
|
||||
'parent_account': 1,
|
||||
'group_or_ledger': 2,
|
||||
'account_type': 3,
|
||||
'report_type': 4,
|
||||
'tax_rate': 5
|
||||
}
|
||||
|
||||
acc_list_india = [
|
||||
['CENVAT Capital Goods','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
|
||||
['CENVAT','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
|
||||
['CENVAT Service Tax','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
|
||||
['CENVAT Service Tax Cess 1','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
|
||||
['CENVAT Service Tax Cess 2','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
|
||||
['CENVAT Edu Cess','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
|
||||
['CENVAT SHE Cess','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
|
||||
['Excise Duty 4','Tax Assets','Ledger','Tax','Balance Sheet','4.00'],
|
||||
['Excise Duty 8','Tax Assets','Ledger','Tax','Balance Sheet','8.00'],
|
||||
['Excise Duty 10','Tax Assets','Ledger','Tax','Balance Sheet','10.00'],
|
||||
['Excise Duty 14','Tax Assets','Ledger','Tax','Balance Sheet','14.00'],
|
||||
['Excise Duty Edu Cess 2','Tax Assets','Ledger','Tax','Balance Sheet','2.00'],
|
||||
['Excise Duty SHE Cess 1','Tax Assets','Ledger','Tax','Balance Sheet','1.00'],
|
||||
['P L A','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
|
||||
['P L A - Cess Portion','Tax Assets','Ledger','Chargeable','Balance Sheet',''],
|
||||
['Edu. Cess on Excise','Duties and Taxes','Ledger','Tax','Balance Sheet','2.00'],
|
||||
['Edu. Cess on Service Tax','Duties and Taxes','Ledger','Tax','Balance Sheet','2.00'],
|
||||
['Edu. Cess on TDS','Duties and Taxes','Ledger','Tax','Balance Sheet','2.00'],
|
||||
['Excise Duty @ 4','Duties and Taxes','Ledger','Tax','Balance Sheet','4.00'],
|
||||
['Excise Duty @ 8','Duties and Taxes','Ledger','Tax','Balance Sheet','8.00'],
|
||||
['Excise Duty @ 10','Duties and Taxes','Ledger','Tax','Balance Sheet','10.00'],
|
||||
['Excise Duty @ 14','Duties and Taxes','Ledger','Tax','Balance Sheet','14.00'],
|
||||
['Service Tax','Duties and Taxes','Ledger','Tax','Balance Sheet','10.3'],
|
||||
['SHE Cess on Excise','Duties and Taxes','Ledger','Tax','Balance Sheet','1.00'],
|
||||
['SHE Cess on Service Tax','Duties and Taxes','Ledger','Tax','Balance Sheet','1.00'],
|
||||
['SHE Cess on TDS','Duties and Taxes','Ledger','Tax','Balance Sheet','1.00'],
|
||||
['Professional Tax','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
|
||||
['VAT','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
|
||||
['TDS (Advertisement)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
|
||||
['TDS (Commission)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
|
||||
['TDS (Contractor)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
|
||||
['TDS (Interest)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
|
||||
['TDS (Rent)','Duties and Taxes','Ledger','Chargeable','Balance Sheet',''],
|
||||
['TDS (Salary)','Duties and Taxes','Ledger','Chargeable','Balance Sheet','']
|
||||
]
|
||||
|
||||
for lst in acc_list_india:
|
||||
account = frappe.get_doc({
|
||||
"doctype": "Account",
|
||||
"freeze_account": "No",
|
||||
"master_type": "",
|
||||
"company": company.name
|
||||
})
|
||||
|
||||
for d in fld_dict.keys():
|
||||
account.set(d, (d == 'parent_account' and lst[fld_dict[d]]) and lst[fld_dict[d]] +' - '+ company.abbr or lst[fld_dict[d]])
|
||||
|
||||
account.insert()
|
@ -1,23 +0,0 @@
|
||||
<p>This is a sample home page for your company <b>%(name)s's</b> website. This was
|
||||
created from the Website Module inside ERPNext. ERPNext provides you with simple
|
||||
tools to build and update your website. You can add sections like your Product Catalog,
|
||||
Blog, Contact Us, About Us and so on. Messages entered in the "Contact" page are
|
||||
automatically added as Leads in the system.
|
||||
|
||||
<h5>What you can do with your website:</h5>
|
||||
|
||||
<ul>
|
||||
<li>Automatically generate products / services catalog from your Items.
|
||||
<li>Capture Leads from your website.
|
||||
<li>Communicate with your customers by sharing your thoughts in your Blog.
|
||||
<li>Introduce your company and team in the About Us page.
|
||||
</ul>
|
||||
|
||||
<p>Infact,
|
||||
<a href="https://erpnext.com" target="_blank">erpnext.com</a>
|
||||
website is built on ERPNext itself.</p>
|
||||
|
||||
<p><a href="login" class="btn btn-primary">Login to your Account</a><p>
|
||||
|
||||
<p class="text-muted pull-right">For more help, <a href="http://erpnext.org" target="_blank">
|
||||
click here</a></p>
|
@ -2,6 +2,7 @@
|
||||
{
|
||||
"abbr": "_TC",
|
||||
"company_name": "_Test Company",
|
||||
"country": "India",
|
||||
"default_currency": "INR",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing"
|
||||
@ -9,8 +10,17 @@
|
||||
{
|
||||
"abbr": "_TC1",
|
||||
"company_name": "_Test Company 1",
|
||||
"country": "United States",
|
||||
"default_currency": "USD",
|
||||
"doctype": "Company",
|
||||
"domain": "Retail"
|
||||
},
|
||||
{
|
||||
"abbr": "_TC2",
|
||||
"company_name": "_Test Company 3",
|
||||
"default_currency": "EUR",
|
||||
"country": "Germany",
|
||||
"doctype": "Company",
|
||||
"domain": "Retail"
|
||||
}
|
||||
]
|
@ -14,23 +14,21 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
self.name = self.item_group_name
|
||||
|
||||
def validate(self):
|
||||
super(ItemGroup, self).on_update()
|
||||
if not self.parent_website_route:
|
||||
self.parent_website_route = frappe.get_website_route("Item Group",
|
||||
self.parent_item_group)
|
||||
|
||||
def on_update(self):
|
||||
NestedSet.on_update(self)
|
||||
WebsiteGenerator.on_update(self)
|
||||
super(ItemGroup, self).on_update()
|
||||
self.validate_name_with_item()
|
||||
self.validate_one_root()
|
||||
|
||||
def after_rename(self, olddn, newdn, merge=False):
|
||||
NestedSet.after_rename(self, olddn, newdn, merge)
|
||||
WebsiteGenerator.after_rename(self, olddn, newdn, merge)
|
||||
super(ItemGroup, self).on_update()
|
||||
|
||||
def on_trash(self):
|
||||
NestedSet.on_trash(self)
|
||||
WebsiteGenerator.on_trash(self)
|
||||
super(ItemGroup, self).on_update()
|
||||
|
||||
def validate_name_with_item(self):
|
||||
if frappe.db.exists("Item", self.name):
|
||||
|
@ -5,8 +5,9 @@ from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
|
||||
from frappe import _
|
||||
|
||||
def after_install():
|
||||
import_defaults()
|
||||
import_country_and_currency()
|
||||
from erpnext.accounts.doctype.chart_of_accounts.import_charts import import_charts
|
||||
import_charts()
|
||||
@ -42,87 +43,6 @@ def import_country_and_currency():
|
||||
"number_format": country.number_format
|
||||
}).insert()
|
||||
|
||||
def import_defaults():
|
||||
records = [
|
||||
# role
|
||||
{'doctype': "Role", "role_name": "Analytics"},
|
||||
|
||||
# item group
|
||||
{'doctype': 'Item Group', 'item_group_name': 'All Item Groups', 'is_group': 'Yes', 'parent_item_group': ''},
|
||||
{'doctype': 'Item Group', 'item_group_name': 'Products', 'is_group': 'No', 'parent_item_group': 'All Item Groups'},
|
||||
{'doctype': 'Item Group', 'item_group_name': 'Raw Material', 'is_group': 'No', 'parent_item_group': 'All Item Groups'},
|
||||
{'doctype': 'Item Group', 'item_group_name': 'Services', 'is_group': 'No', 'parent_item_group': 'All Item Groups'},
|
||||
{'doctype': 'Item Group', 'item_group_name': 'Sub Assemblies', 'is_group': 'No', 'parent_item_group': 'All Item Groups'},
|
||||
{'doctype': 'Item Group', 'item_group_name': 'Consumable', 'is_group': 'No', 'parent_item_group': 'All Item Groups'},
|
||||
|
||||
# deduction type
|
||||
{'doctype': 'Deduction Type', 'name': 'Income Tax', 'description': 'Income Tax', 'deduction_name': 'Income Tax'},
|
||||
{'doctype': 'Deduction Type', 'name': 'Professional Tax', 'description': 'Professional Tax', 'deduction_name': 'Professional Tax'},
|
||||
{'doctype': 'Deduction Type', 'name': 'Provident Fund', 'description': 'Provident fund', 'deduction_name': 'Provident Fund'},
|
||||
|
||||
# earning type
|
||||
{'doctype': 'Earning Type', 'name': 'Basic', 'description': 'Basic', 'earning_name': 'Basic', 'taxable': 'Yes'},
|
||||
{'doctype': 'Earning Type', 'name': 'House Rent Allowance', 'description': 'House Rent Allowance', 'earning_name': 'House Rent Allowance', 'taxable': 'No'},
|
||||
|
||||
# expense claim type
|
||||
{'doctype': 'Expense Claim Type', 'name': 'Calls', 'expense_type': 'Calls'},
|
||||
{'doctype': 'Expense Claim Type', 'name': 'Food', 'expense_type': 'Food'},
|
||||
{'doctype': 'Expense Claim Type', 'name': 'Medical', 'expense_type': 'Medical'},
|
||||
{'doctype': 'Expense Claim Type', 'name': 'Others', 'expense_type': 'Others'},
|
||||
{'doctype': 'Expense Claim Type', 'name': 'Travel', 'expense_type': 'Travel'},
|
||||
|
||||
# leave type
|
||||
{'doctype': 'Leave Type', 'leave_type_name': 'Casual Leave', 'name': 'Casual Leave', 'is_encash': 1, 'is_carry_forward': 1, 'max_days_allowed': '3', },
|
||||
{'doctype': 'Leave Type', 'leave_type_name': 'Compensatory Off', 'name': 'Compensatory Off', 'is_encash': 0, 'is_carry_forward': 0, },
|
||||
{'doctype': 'Leave Type', 'leave_type_name': 'Sick Leave', 'name': 'Sick Leave', 'is_encash': 0, 'is_carry_forward': 0, },
|
||||
{'doctype': 'Leave Type', 'leave_type_name': 'Privilege Leave', 'name': 'Privilege Leave', 'is_encash': 0, 'is_carry_forward': 0, },
|
||||
{'doctype': 'Leave Type', 'leave_type_name': 'Leave Without Pay', 'name': 'Leave Without Pay', 'is_encash': 0, 'is_carry_forward': 0, 'is_lwp':1},
|
||||
|
||||
# territory
|
||||
{'doctype': 'Territory', 'territory_name': 'All Territories', 'is_group': 'Yes', 'name': 'All Territories', 'parent_territory': ''},
|
||||
|
||||
# customer group
|
||||
{'doctype': 'Customer Group', 'customer_group_name': 'All Customer Groups', 'is_group': 'Yes', 'name': 'All Customer Groups', 'parent_customer_group': ''},
|
||||
{'doctype': 'Customer Group', 'customer_group_name': 'Individual', 'is_group': 'No', 'parent_customer_group': 'All Customer Groups'},
|
||||
{'doctype': 'Customer Group', 'customer_group_name': 'Commercial', 'is_group': 'No', 'parent_customer_group': 'All Customer Groups'},
|
||||
{'doctype': 'Customer Group', 'customer_group_name': 'Non Profit', 'is_group': 'No', 'parent_customer_group': 'All Customer Groups'},
|
||||
{'doctype': 'Customer Group', 'customer_group_name': 'Government', 'is_group': 'No', 'parent_customer_group': 'All Customer Groups'},
|
||||
|
||||
# supplier type
|
||||
{'doctype': 'Supplier Type', 'supplier_type': 'Services'},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': 'Local'},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': 'Raw Material'},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': 'Electrical'},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': 'Hardware'},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': 'Pharmaceutical'},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': 'Distributor'},
|
||||
|
||||
# Sales Person
|
||||
{'doctype': 'Sales Person', 'sales_person_name': 'Sales Team', 'is_group': "Yes", "parent_sales_person": ""},
|
||||
|
||||
# UOM
|
||||
{'uom_name': 'Unit', 'doctype': 'UOM', 'name': 'Unit', "must_be_whole_number": 1},
|
||||
{'uom_name': 'Box', 'doctype': 'UOM', 'name': 'Box', "must_be_whole_number": 1},
|
||||
{'uom_name': 'Kg', 'doctype': 'UOM', 'name': 'Kg'},
|
||||
{'uom_name': 'Nos', 'doctype': 'UOM', 'name': 'Nos', "must_be_whole_number": 1},
|
||||
{'uom_name': 'Pair', 'doctype': 'UOM', 'name': 'Pair', "must_be_whole_number": 1},
|
||||
{'uom_name': 'Set', 'doctype': 'UOM', 'name': 'Set', "must_be_whole_number": 1},
|
||||
{'uom_name': 'Hour', 'doctype': 'UOM', 'name': 'Hour'},
|
||||
{'uom_name': 'Minute', 'doctype': 'UOM', 'name': 'Minute'},
|
||||
|
||||
]
|
||||
|
||||
from frappe.modules import scrub
|
||||
for r in records:
|
||||
doc = frappe.get_doc(r)
|
||||
|
||||
# ignore mandatory for root
|
||||
parent_link_field = ("parent_" + scrub(doc.doctype))
|
||||
if doc.meta.get_field(parent_link_field) and not doc.get(parent_link_field):
|
||||
doc.ignore_mandatory = True
|
||||
|
||||
doc.insert()
|
||||
|
||||
def feature_setup():
|
||||
"""save global defaults and features setup"""
|
||||
doc = frappe.get_doc("Features Setup", "Features Setup")
|
||||
|
93
erpnext/setup/page/setup_wizard/default_website.py
Normal file
93
erpnext/setup/page/setup_wizard/default_website.py
Normal file
@ -0,0 +1,93 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, os
|
||||
|
||||
from frappe import _
|
||||
from frappe.utils import nowdate
|
||||
|
||||
class website_maker(object):
|
||||
def __init__(self, company, tagline, user):
|
||||
self.company = company
|
||||
self.tagline = tagline
|
||||
self.user = user
|
||||
self.make_web_page()
|
||||
self.make_style_settings()
|
||||
self.make_website_settings()
|
||||
self.make_blog()
|
||||
|
||||
def make_web_page(self):
|
||||
self.webpage = frappe.get_doc({
|
||||
"doctype": "Web Page",
|
||||
"title": self.company,
|
||||
"published": 1,
|
||||
"header": "<h1>{0}</h1>".format(self.tagline)+\
|
||||
'<p>'+_("This is an example website auto-generated from ERPNext")+"</p>"+\
|
||||
'<p><a class="btn btn-primary" href="/login">Login</a></p>',
|
||||
"description": self.company + ":" + self.tagline,
|
||||
"css": frappe.get_template("setup/page/setup_wizard/sample_home_page.css").render(),
|
||||
"main_section": frappe.get_template("setup/page/setup_wizard/sample_home_page.html").render({
|
||||
"company": self.company, "tagline": self.tagline
|
||||
})
|
||||
}).insert()
|
||||
|
||||
def make_style_settings(self):
|
||||
style_settings = frappe.get_doc("Style Settings", "Style Settings")
|
||||
style_settings.top_bar_background = "F2F2F2"
|
||||
style_settings.font_size = "15px"
|
||||
style_settings.save()
|
||||
|
||||
def make_website_settings(self):
|
||||
# update in home page in settings
|
||||
website_settings = frappe.get_doc("Website Settings", "Website Settings")
|
||||
website_settings.home_page = self.webpage.name
|
||||
website_settings.brand_html = self.company
|
||||
website_settings.copyright = self.company
|
||||
website_settings.top_bar_items = []
|
||||
website_settings.append("top_bar_items", {
|
||||
"doctype": "Top Bar Item",
|
||||
"label":"Contact",
|
||||
"url": "contact"
|
||||
})
|
||||
website_settings.append("top_bar_items", {
|
||||
"doctype": "Top Bar Item",
|
||||
"label":"Blog",
|
||||
"url": "blog"
|
||||
})
|
||||
website_settings.save()
|
||||
|
||||
def make_blog(self):
|
||||
blogger = frappe.new_doc("Blogger")
|
||||
user = frappe.get_doc("User", self.user)
|
||||
blogger.user = self.user
|
||||
blogger.full_name = user.first_name + (" " + user.last_name if user.last_name else "")
|
||||
blogger.short_name = user.first_name.lower()
|
||||
blogger.avatar = user.user_image
|
||||
blogger.insert()
|
||||
|
||||
blog_category = frappe.get_doc({
|
||||
"doctype": "Blog Category",
|
||||
"category_name": "general",
|
||||
"published": 1,
|
||||
"title": _("General")
|
||||
}).insert()
|
||||
|
||||
blog_post = frappe.get_doc({
|
||||
"doctype": "Blog Post",
|
||||
"title": "Welcome",
|
||||
"published": 1,
|
||||
"published_on": nowdate(),
|
||||
"blogger": blogger.name,
|
||||
"blog_category": blog_category.name,
|
||||
"blog_intro": "My First Blog",
|
||||
"content": frappe.get_template("setup/page/setup_wizard/sample_blog_post.html").render(),
|
||||
}).insert()
|
||||
|
||||
def test():
|
||||
frappe.delete_doc("Web Page", "test-company")
|
||||
frappe.delete_doc("Blog Post", "welcome")
|
||||
frappe.delete_doc("Blogger", "administrator")
|
||||
frappe.delete_doc("Blog Category", "general")
|
||||
website_maker("Test Company", "Better Tools for Everyone", "Administrator")
|
||||
frappe.db.commit()
|
87
erpnext/setup/page/setup_wizard/install_fixtures.py
Normal file
87
erpnext/setup/page/setup_wizard/install_fixtures.py
Normal file
@ -0,0 +1,87 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
|
||||
from frappe import _
|
||||
|
||||
def install():
|
||||
records = [
|
||||
# role
|
||||
{'doctype': "Role", "role_name": "Analytics"},
|
||||
|
||||
# item group
|
||||
{'doctype': 'Item Group', 'item_group_name': _('All Item Groups'), 'is_group': 'Yes', 'parent_item_group': ''},
|
||||
{'doctype': 'Item Group', 'item_group_name': _('Products'), 'is_group': 'No',
|
||||
'parent_item_group': _('All Item Groups'), "show_in_website": 1 },
|
||||
{'doctype': 'Item Group', 'item_group_name': _('Raw Material'), 'is_group': 'No', 'parent_item_group': _('All Item Groups') },
|
||||
{'doctype': 'Item Group', 'item_group_name': _('Services'), 'is_group': 'No', 'parent_item_group': _('All Item Groups') },
|
||||
{'doctype': 'Item Group', 'item_group_name': _('Sub Assemblies'), 'is_group': 'No', 'parent_item_group': _('All Item Groups') },
|
||||
{'doctype': 'Item Group', 'item_group_name': _('Consumable'), 'is_group': 'No', 'parent_item_group': _('All Item Groups') },
|
||||
|
||||
# deduction type
|
||||
{'doctype': 'Deduction Type', 'name': _('Income Tax'), 'description': _('Income Tax'), 'deduction_name': _('Income Tax')},
|
||||
|
||||
# earning type
|
||||
{'doctype': 'Earning Type', 'name': _('Basic'), 'description': _('Basic'), 'earning_name': _('Basic'), 'taxable': 'Yes'},
|
||||
|
||||
# expense claim type
|
||||
{'doctype': 'Expense Claim Type', 'name': _('Calls'), 'expense_type': _('Calls')},
|
||||
{'doctype': 'Expense Claim Type', 'name': _('Food'), 'expense_type': _('Food')},
|
||||
{'doctype': 'Expense Claim Type', 'name': _('Medical'), 'expense_type': _('Medical')},
|
||||
{'doctype': 'Expense Claim Type', 'name': _('Others'), 'expense_type': _('Others')},
|
||||
{'doctype': 'Expense Claim Type', 'name': _('Travel'), 'expense_type': _('Travel')},
|
||||
|
||||
# leave type
|
||||
{'doctype': 'Leave Type', 'leave_type_name': _('Casual Leave'), 'name': _('Casual Leave'), 'is_encash': 1, 'is_carry_forward': 1, 'max_days_allowed': '3', },
|
||||
{'doctype': 'Leave Type', 'leave_type_name': _('Compensatory Off'), 'name': _('Compensatory Off'), 'is_encash': 0, 'is_carry_forward': 0, },
|
||||
{'doctype': 'Leave Type', 'leave_type_name': _('Sick Leave'), 'name': _('Sick Leave'), 'is_encash': 0, 'is_carry_forward': 0, },
|
||||
{'doctype': 'Leave Type', 'leave_type_name': _('Privilege Leave'), 'name': _('Privilege Leave'), 'is_encash': 0, 'is_carry_forward': 0, },
|
||||
{'doctype': 'Leave Type', 'leave_type_name': _('Leave Without Pay'), 'name': _('Leave Without Pay'), 'is_encash': 0, 'is_carry_forward': 0, 'is_lwp':1},
|
||||
|
||||
# territory
|
||||
{'doctype': 'Territory', 'territory_name': _('All Territories'), 'is_group': 'Yes', 'name': _('All Territories'), 'parent_territory': ''},
|
||||
|
||||
# customer group
|
||||
{'doctype': 'Customer Group', 'customer_group_name': _('All Customer Groups'), 'is_group': 'Yes', 'name': _('All Customer Groups'), 'parent_customer_group': ''},
|
||||
{'doctype': 'Customer Group', 'customer_group_name': _('Individual'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
|
||||
{'doctype': 'Customer Group', 'customer_group_name': _('Commercial'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
|
||||
{'doctype': 'Customer Group', 'customer_group_name': _('Non Profit'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
|
||||
{'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
|
||||
|
||||
# supplier type
|
||||
{'doctype': 'Supplier Type', 'supplier_type': _('Services')},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': _('Local')},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': _('Raw Material')},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': _('Electrical')},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': _('Hardware')},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': _('Pharmaceutical')},
|
||||
{'doctype': 'Supplier Type', 'supplier_type': _('Distributor')},
|
||||
|
||||
# Sales Person
|
||||
{'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': "Yes", "parent_sales_person": ""},
|
||||
|
||||
# UOM
|
||||
{'uom_name': _('Unit'), 'doctype': 'UOM', 'name': 'Unit', "must_be_whole_number": 1},
|
||||
{'uom_name': _('Box'), 'doctype': 'UOM', 'name': 'Box', "must_be_whole_number": 1},
|
||||
{'uom_name': _('Kg'), 'doctype': 'UOM', 'name': 'Kg'},
|
||||
{'uom_name': _('Nos'), 'doctype': 'UOM', 'name': 'Nos', "must_be_whole_number": 1},
|
||||
{'uom_name': _('Pair'), 'doctype': 'UOM', 'name': 'Pair', "must_be_whole_number": 1},
|
||||
{'uom_name': _('Set'), 'doctype': 'UOM', 'name': 'Set', "must_be_whole_number": 1},
|
||||
{'uom_name': _('Hour'), 'doctype': 'UOM', 'name': 'Hour'},
|
||||
{'uom_name': _('Minute'), 'doctype': 'UOM', 'name': 'Minute'},
|
||||
|
||||
]
|
||||
|
||||
from frappe.modules import scrub
|
||||
for r in records:
|
||||
doc = frappe.get_doc(r)
|
||||
|
||||
# ignore mandatory for root
|
||||
parent_link_field = ("parent_" + scrub(doc.doctype))
|
||||
if doc.meta.get_field(parent_link_field) and not doc.get(parent_link_field):
|
||||
doc.ignore_mandatory = True
|
||||
|
||||
doc.insert()
|
3
erpnext/setup/page/setup_wizard/sample_blog_post.html
Normal file
3
erpnext/setup/page/setup_wizard/sample_blog_post.html
Normal file
@ -0,0 +1,3 @@
|
||||
<p class="lead">We have just starting using ERPNext, the Open Source ERP built for the web and loving it.</p>
|
||||
|
||||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
|
29
erpnext/setup/page/setup_wizard/sample_home_page.css
Normal file
29
erpnext/setup/page/setup_wizard/sample_home_page.css
Normal file
@ -0,0 +1,29 @@
|
||||
.page-header {
|
||||
color: white;
|
||||
background-color: #444;
|
||||
padding: 40px 0px;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.slide {
|
||||
padding: 60px 40px;
|
||||
max-width: 900px;
|
||||
margin: auto;
|
||||
border-top: 1px solid #f2f2f2;
|
||||
}
|
||||
|
||||
.slide h3 {
|
||||
margin-bottom: 70px;
|
||||
}
|
||||
|
||||
.img-wrapper {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #f9f9f9;
|
||||
}
|
26
erpnext/setup/page/setup_wizard/sample_home_page.html
Normal file
26
erpnext/setup/page/setup_wizard/sample_home_page.html
Normal file
@ -0,0 +1,26 @@
|
||||
<p class="lead text-center">
|
||||
{{ _("We make world class products and offer world class services") }}
|
||||
</p>
|
||||
<div class="row slide">
|
||||
<h3 class="text-center">{{ _("Awesome Products") }}</h3>
|
||||
<div class="col-md-6 text-center">
|
||||
<div class="img-wrapper">
|
||||
<i class="icon-wrench text-muted" style="font-size: 100px;"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row slide alt">
|
||||
<h3 class="text-center">{{ _("Awesome Services") }}</h3>
|
||||
<div class="col-md-6 text-center">
|
||||
<div class="img-wrapper">
|
||||
<i class="icon-phone text-muted" style="font-size: 100px;"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- no-sidebar -->
|
@ -290,10 +290,10 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
||||
{fieldtype:"Section Break"},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Select", label:"Group", fieldname:"item_group_" + i,
|
||||
options:["Products", "Services", "Raw Material", "Sub Assemblies"]},
|
||||
options:[_("Products"), _("Services")]},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Select", fieldname:"item_uom_" + i, label:"UOM",
|
||||
options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
|
||||
options:[_("Unit"), _("Nos"), _("Box"), _("Pair"), _("Kg"), _("Set"), _("Hour"), _("Minute")]},
|
||||
{fieldtype:"Section Break"}
|
||||
])
|
||||
}
|
||||
@ -317,10 +317,10 @@ frappe.pages['setup-wizard'].onload = function(wrapper) {
|
||||
{fieldtype:"Section Break"},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Select", fieldname:"item_buy_group_" + i, label: __("Group"),
|
||||
options:["Raw Material", "Consumable", "Sub Assemblies", "Services", "Products"]},
|
||||
options:[_("Raw Material"), _("Consumable"), _("Sub Assemblies"), _("Services"), _("Products")]},
|
||||
{fieldtype:"Column Break"},
|
||||
{fieldtype:"Select", fieldname:"item_buy_uom_" + i, label: __("UOM"),
|
||||
options:["Unit", "Nos", "Box", "Pair", "Kg", "Set", "Hour", "Minute"]},
|
||||
options:[_("Unit"), _("Nos"), _("Box"), _("Pair"), _("Kg"), _("Set"), _("Hour"), _("Minute")]},
|
||||
{fieldtype:"Section Break"},
|
||||
])
|
||||
}
|
||||
|
@ -5,9 +5,12 @@ from __future__ import unicode_literals
|
||||
import frappe, json
|
||||
|
||||
from frappe.utils import cstr, getdate
|
||||
from frappe import _
|
||||
from frappe.utils.file_manager import save_file
|
||||
from frappe.translate import set_default_language, get_dict, get_lang_dict
|
||||
from frappe.country_info import get_country_info
|
||||
from default_website import website_maker
|
||||
import install_fixtures
|
||||
|
||||
@frappe.whitelist()
|
||||
def setup_account(args=None):
|
||||
@ -23,6 +26,8 @@ def setup_account(args=None):
|
||||
if args.language != "english":
|
||||
set_default_language(args.language)
|
||||
|
||||
install_fixtures.install()
|
||||
|
||||
update_user_name(args)
|
||||
frappe.local.message_log = []
|
||||
|
||||
@ -61,6 +66,8 @@ def setup_account(args=None):
|
||||
|
||||
frappe.db.set_default('desktop:home_page', 'desktop')
|
||||
|
||||
website_maker(args.company_name, args.company_tagline, args.email)
|
||||
|
||||
frappe.clear_cache()
|
||||
frappe.db.commit()
|
||||
|
||||
@ -127,7 +134,7 @@ def create_price_lists(args):
|
||||
"selling": 1 if pl_type == "Selling" else 0,
|
||||
"currency": args["currency"],
|
||||
"valid_for_territories": [{
|
||||
"territory": "All Territories"
|
||||
"territory": frappe.db.get_value("Territory", {"parent_territory":""})
|
||||
}]
|
||||
}).insert()
|
||||
|
||||
@ -273,10 +280,11 @@ def create_items(args):
|
||||
"item_name": item,
|
||||
"description": item,
|
||||
"is_sales_item": "Yes",
|
||||
"is_stock_item": item_group!="Services" and "Yes" or "No",
|
||||
"show_in_website": 1,
|
||||
"is_stock_item": item_group!=_("Services") and "Yes" or "No",
|
||||
"item_group": item_group,
|
||||
"stock_uom": args.get("item_uom_" + str(i)),
|
||||
"default_warehouse": item_group!="Service" and ("Finished Goods - " + args.get("company_abbr")) or ""
|
||||
"default_warehouse": item_group!=_("Service") and (_("Finished Goods") + " - " + args.get("company_abbr")) or ""
|
||||
}).insert()
|
||||
|
||||
if args.get("item_img_" + str(i)):
|
||||
@ -294,10 +302,10 @@ def create_items(args):
|
||||
"item_name": item,
|
||||
"description": item,
|
||||
"is_sales_item": "No",
|
||||
"is_stock_item": item_group!="Services" and "Yes" or "No",
|
||||
"is_stock_item": item_group!=_("Services") and "Yes" or "No",
|
||||
"item_group": item_group,
|
||||
"stock_uom": args.get("item_buy_uom_" + str(i)),
|
||||
"default_warehouse": item_group!="Service" and ("Stores - " + args.get("company_abbr")) or ""
|
||||
"default_warehouse": item_group!=_("Services") and (_("Stores") + " - " + args.get("company_abbr")) or ""
|
||||
}).insert()
|
||||
|
||||
if args.get("item_img_" + str(i)):
|
||||
@ -314,7 +322,7 @@ def create_customers(args):
|
||||
"doctype":"Customer",
|
||||
"customer_name": customer,
|
||||
"customer_type": "Company",
|
||||
"customer_group": "Commercial",
|
||||
"customer_group": _("Commercial"),
|
||||
"territory": args.get("country"),
|
||||
"company": args.get("company_name")
|
||||
}).insert()
|
||||
@ -335,7 +343,7 @@ def create_suppliers(args):
|
||||
frappe.get_doc({
|
||||
"doctype":"Supplier",
|
||||
"supplier_name": supplier,
|
||||
"supplier_type": "Local",
|
||||
"supplier_type": _("Local"),
|
||||
"company": args.get("company_name")
|
||||
}).insert()
|
||||
|
||||
@ -353,13 +361,13 @@ def create_letter_head(args):
|
||||
if args.get("attach_letterhead"):
|
||||
frappe.get_doc({
|
||||
"doctype":"Letter Head",
|
||||
"letter_head_name": "Standard",
|
||||
"letter_head_name": _("Standard"),
|
||||
"is_default": 1
|
||||
}).insert()
|
||||
|
||||
filename, filetype, content = args.get("attach_letterhead").split(",")
|
||||
fileurl = save_file(filename, content, "Letter Head", "Standard", decode=True).file_name
|
||||
frappe.db.set_value("Letter Head", "Standard", "content", "<img src='%s' style='max-width: 100%%;'>" % fileurl)
|
||||
fileurl = save_file(filename, content, "Letter Head", _("Standard"), decode=True).file_name
|
||||
frappe.db.set_value("Letter Head", _("Standard"), "content", "<img src='%s' style='max-width: 100%%;'>" % fileurl)
|
||||
|
||||
def add_all_roles_to(name):
|
||||
user = frappe.get_doc("User", name)
|
||||
@ -374,7 +382,7 @@ def create_territories():
|
||||
from frappe.utils.nestedset import get_root_of
|
||||
country = frappe.db.get_default("country")
|
||||
root_territory = get_root_of("Territory")
|
||||
for name in (country, "Rest Of The World"):
|
||||
for name in (country, _("Rest Of The World")):
|
||||
if name and not frappe.db.exists("Territory", name):
|
||||
frappe.get_doc({
|
||||
"doctype": "Territory",
|
||||
@ -392,3 +400,4 @@ def load_messages(language):
|
||||
frappe.local.response["__messages"] = m
|
||||
return lang
|
||||
|
||||
|
||||
|
@ -1,204 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
#!/usr/bin/python
|
||||
|
||||
# This script is for cleaning up of all data from system including
|
||||
# all transactions and masters (excludes default masters).
|
||||
# Basically after running this file, system will reset to it's
|
||||
# initial state.
|
||||
# This script can be executed from lib/wnf.py using
|
||||
# lib/wnf.py --cleanup-data
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import sys
|
||||
sys.path.append("lib/py")
|
||||
sys.path.append(".")
|
||||
sys.path.append("erpnext")
|
||||
|
||||
import frappe
|
||||
|
||||
#--------------------------------
|
||||
|
||||
def delete_transactions():
|
||||
print "Deleting transactions..."
|
||||
|
||||
trans = ['Task', 'Support Ticket', 'Stock Reconciliation', 'Stock Ledger Entry',
|
||||
'Stock Entry', 'Sales Order', 'Salary Slip','Sales Invoice', 'Quotation',
|
||||
'Quality Inspection', 'Purchase Receipt', 'Purchase Order', 'Production Order',
|
||||
'POS Setting', 'Period Closing Voucher', 'Purchase Invoice', 'Maintenance Visit',
|
||||
'Maintenance Schedule', 'Leave Application', 'Leave Allocation', 'Lead', 'Journal Voucher',
|
||||
'Installation Note', 'Material Request', 'GL Entry', 'Expense Claim', 'Opportunity',
|
||||
'Delivery Note', 'Customer Issue', 'Bin', 'Authorization Rule', 'Attendance', 'C-Form',
|
||||
'Appraisal', 'Installation Note', 'Communication', "Supplier Quotation", "Newsletter",
|
||||
"Job Applicant", "Web Page", "Website Slideshow", "Blog Post", "Blog Category", "Blogger",
|
||||
"Time Log", "Time Log Batch", "Workflow"]
|
||||
for d in trans:
|
||||
for t in frappe.db.sql("select options from tabDocField \
|
||||
where parent=%s and fieldtype='Table'", d):
|
||||
frappe.db.sql("delete from `tab%s`" % (t))
|
||||
frappe.db.sql("delete from `tab%s`" % (d))
|
||||
print "Deleted " + d
|
||||
|
||||
|
||||
|
||||
def delete_masters():
|
||||
print "Deleting masters...."
|
||||
masters = {
|
||||
'Workstation': ['Default Workstation'],
|
||||
'Warehouse': ['Default Warehouse'],
|
||||
'UOM': ['Kg', 'Mtr', 'Box', 'Ltr', 'Nos', 'Ft', 'Pair', 'Set'],
|
||||
'Territory': ['All Territories', 'Default Territory'],
|
||||
'Terms and Conditions': '',
|
||||
'Tag': '',
|
||||
'Supplier Type': ['Default Supplier Type'],
|
||||
'Supplier': '',
|
||||
'Serial No': '',
|
||||
'Sales Person': ['Sales Team'],
|
||||
'Sales Partner': '',
|
||||
'Sales BOM': '',
|
||||
'Salary Structure': '',
|
||||
'Purchase Taxes and Charges Master': '',
|
||||
'Project': '',
|
||||
'Print Heading': '',
|
||||
'Price List': ['Default Price List'],
|
||||
'Sales Taxes and Charges Master': '',
|
||||
'Letter Head': '',
|
||||
'Leave Type': ['Leave Without Pay', 'Privilege Leave', 'Casual Leave', 'PL', 'CL', 'LWP',
|
||||
'Compensatory Off', 'Sick Leave'],
|
||||
'Appraisal Template': '',
|
||||
'Item Group': ['All Item Groups', 'Default'],
|
||||
'Item': '',
|
||||
'Holiday List': '',
|
||||
'Activity Type': '',
|
||||
'Grade': '',
|
||||
'Feed': '',
|
||||
'Expense Claim Type': ['Travel', 'Medical', 'Calls', 'Food', 'Others'],
|
||||
'Event': '',
|
||||
'Employment Type': '',
|
||||
'Employee': '',
|
||||
'Earning Type': ['Basic', 'Conveyance', 'House Rent Allowance', 'Dearness Allowance',
|
||||
'Medical Allowance', 'Telephone'],
|
||||
'Designation': '',
|
||||
'Department': '',
|
||||
'Deduction Type': ['Income Tax', 'Professional Tax', 'Provident Fund', 'Leave Deduction'],
|
||||
'Customer Group': ['All Customer Groups', 'Default Customer Group'],
|
||||
'Customer': '',
|
||||
'Cost Center': '',
|
||||
'Contact': '',
|
||||
'Campaign': '',
|
||||
'Budget Distribution': '',
|
||||
'Brand': '',
|
||||
'Branch': '',
|
||||
'Batch': '',
|
||||
'Appraisal': '',
|
||||
'Account': '',
|
||||
'BOM': ''
|
||||
}
|
||||
for d in masters.keys():
|
||||
for t in frappe.db.sql("select options from tabDocField where parent=%s \
|
||||
and fieldtype='Table'", d):
|
||||
frappe.db.sql("delete from `tab%s`" % (t))
|
||||
frappe.db.sql("delete from `tab%s` where name not in (%s)" %
|
||||
(d, ', '.join(['%s']*len(masters[d]), masters[d])))
|
||||
print "Deleted " + d
|
||||
|
||||
|
||||
|
||||
def reset_all_series():
|
||||
# Reset master series
|
||||
frappe.db.sql("""update tabSeries set current = 0 where name not in
|
||||
('Ann/', 'BSD', 'DEF', 'DF', 'EV', 'Event Updates/', 'FileData-',
|
||||
'FL', 'FMD/', 'GLM Detail', 'Login Page/', 'MDI', 'MDR', 'MI', 'MIR',
|
||||
'PERM', 'PR', 'SRCH/C/', 'TD', 'TIC/', 'TMD/', 'TW', 'UR', '_FEED',
|
||||
'_SRCH', '_TRIGGER', '__NSO', 'CustomField', 'Letter')
|
||||
""")
|
||||
print "Series updated"
|
||||
|
||||
def reset_transaction_series():
|
||||
frappe.db.sql("""update tabSeries set current = 0 where name in
|
||||
('JV', 'INV', 'BILL', 'SO', 'DN', 'PO', 'LEAD', 'ENQUIRY', 'ENQ', 'CI',
|
||||
'IN', 'PS', 'IDT', 'QAI', 'QTN', 'STE', 'SQTN', 'SUP', 'SR',
|
||||
'POS', 'LAP', 'LAL', 'EXP')""")
|
||||
print "Series updated"
|
||||
|
||||
|
||||
def delete_main_masters():
|
||||
main_masters = ['Fiscal Year', 'Company', 'DefaultValue']
|
||||
for d in main_masters:
|
||||
for t in frappe.db.sql("select options from tabDocField \
|
||||
where parent=%s and fieldtype='Table'", d):
|
||||
frappe.db.sql("delete from `tab%s`" % (t))
|
||||
frappe.db.sql("delete from `tab%s`" % (d))
|
||||
print "Deleted " + d
|
||||
|
||||
def reset_global_defaults():
|
||||
flds = {
|
||||
'default_company': None,
|
||||
'default_currency': None,
|
||||
'current_fiscal_year': None,
|
||||
'date_format': 'dd-mm-yyyy',
|
||||
'sms_sender_name': None,
|
||||
'default_item_group': 'Default',
|
||||
'default_stock_uom': 'Nos',
|
||||
'default_valuation_method': 'FIFO',
|
||||
'tolerance': None,
|
||||
'acc_frozen_upto': None,
|
||||
'bde_auth_role': None,
|
||||
'credit_controller': None,
|
||||
'default_customer_group': 'Default Customer Group',
|
||||
'default_territory': 'Default',
|
||||
'default_price_list': 'Standard',
|
||||
'default_supplier_type': 'Default Supplier Type',
|
||||
'hide_currency_symbol': None,
|
||||
'default_price_list_currency': None,
|
||||
}
|
||||
|
||||
gd = frappe.get_doc('Global Defaults', 'Global Defaults')
|
||||
for d in flds:
|
||||
gd.set(d, flds[d])
|
||||
gd.save()
|
||||
|
||||
frappe.clear_cache()
|
||||
|
||||
|
||||
def run():
|
||||
frappe.connect()
|
||||
frappe.db.begin()
|
||||
|
||||
# Confirmation from user
|
||||
confirm = ''
|
||||
while not confirm:
|
||||
confirm = raw_input("Are you sure you want to delete the data from the system (N/Y)?")
|
||||
if confirm.lower() != 'y':
|
||||
raise Exception
|
||||
|
||||
cleanup_type = ''
|
||||
while cleanup_type not in ['1', '2']:
|
||||
cleanup_type = raw_input("""\nWhat type of cleanup you want ot perform?
|
||||
1. Only Transactions
|
||||
2. Both Masters and Transactions
|
||||
|
||||
Please enter your choice (1/2):
|
||||
""")
|
||||
|
||||
# delete
|
||||
delete_transactions()
|
||||
|
||||
if cleanup_type == '1':
|
||||
print "Reset Transaction Series"
|
||||
reset_transaction_series()
|
||||
else:
|
||||
delete_masters()
|
||||
print "Reset All Series"
|
||||
reset_all_series()
|
||||
delete_main_masters()
|
||||
reset_global_defaults()
|
||||
|
||||
print "System cleaned up succesfully"
|
||||
frappe.db.commit()
|
||||
frappe.db.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
Loading…
Reference in New Issue
Block a user