Пример #1
0
def create_account_doctype():
	# update accounts
	import webnotes.db

	webnotes.conn = webnotes.db.Database(use_default = 1)
	webnotes.session = {'user':'******'}	

	from webnotes.model.doc import Document
	import webnotes.model.db_schema

	# create tabAccount
	ac = Document('DocType')
	ac.name = 'Account'
	ac.autoname = 'AC.#####'
	ac.save(1)
		
	f = ac.addchild('fields', 'DocField')
	f.label = 'Account Name'
	f.fieldname = 'ac_name'
	f.fieldtype = 'Data'
	f.save()

	f = ac.addchild('fields', 'DocField')
	f.label = 'Database Name'
	f.fieldname = 'db_name'
	f.fieldtype = 'Data'
	f.save()

	f = ac.addchild('fields', 'DocField')
	f.label = 'Database Login'
	f.fieldname = 'db_login'
	f.fieldtype = 'Data'
	f.save()

	f = ac.addchild('fields', 'DocField')
	f.label = 'App Login'
	f.fieldname = 'app_login'
	f.fieldtype = 'Data'
	f.save()
		
	f = ac.addchild('permissions', 'DocPerm')
	f.role = 'Administrator'
	f.read = 1
	f.write = 1
	f.create = 1
	f.save()
	
	# udpate schema
	webnotes.model.db_schema.updatedb('Account')
Пример #2
0
def load_data():
	test_purchase_receipt.load_data()
	
	webnotes.insert({"doctype": "Account", "account_name": "Cost for Goods Sold",
		"parent_account": "Expenses - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
	
	webnotes.insert({"doctype": "Account", "account_name": "Excise Duty",
		"parent_account": "_Test Tax Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
	
	webnotes.insert({"doctype": "Account", "account_name": "Education Cess",
		"parent_account": "_Test Tax Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
	
	webnotes.insert({"doctype": "Account", "account_name": "S&H Education Cess",
		"parent_account": "_Test Tax Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
		
	webnotes.insert({"doctype": "Account", "account_name": "CST",
		"parent_account": "Direct Expenses - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
		
	webnotes.insert({"doctype": "Account", "account_name": "Discount",
		"parent_account": "Direct Expenses - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
		
	from webnotes.model.doc import Document
	item = Document("Item", "Home Desktop 100")
	
	# excise duty
	item_tax = item.addchild("item_tax", "Item Tax")
	item_tax.tax_type = "Excise Duty - %s" % abbr
	item_tax.tax_rate = 10
	item_tax.save()
Пример #3
0
def create_account_record(ac_name, newdb, domain=''):
	# update accounts
	import webnotes.db

	webnotes.conn = webnotes.db.Database(use_default = 1)
	
	if not webnotes.conn.in_transaction:
		webnotes.conn.sql("start transaction")

	if not webnotes.session:
		webnotes.session = {'user':'******'}

	from webnotes.model.doc import Document
	
	ac = Document('Account')
	ac.ac_name = ac_name
	ac.db_name = newdb
	ac.name = newdb
	ac.save(1)
	
	# add domain
	if domain:
		acd = ac.addchild('account_domains','Account Domain',1)
		acd.domain = ac_name + '.' + domain
		acd.save(1)

	webnotes.conn.sql("commit")
Пример #4
0
def load_data():
    test_purchase_receipt.load_data()

    webnotes.insert({
        "doctype": "Account",
        "account_name": "Excise Duty",
        "parent_account": "Tax Assets - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    webnotes.insert({
        "doctype": "Account",
        "account_name": "Education Cess",
        "parent_account": "Tax Assets - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    webnotes.insert({
        "doctype": "Account",
        "account_name": "S&H Education Cess",
        "parent_account": "Tax Assets - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    webnotes.insert({
        "doctype": "Account",
        "account_name": "CST",
        "parent_account": "Direct Expenses - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    webnotes.insert({
        "doctype": "Account",
        "account_name": "Discount",
        "parent_account": "Direct Expenses - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    from webnotes.model.doc import Document
    item = Document("Item", "Home Desktop 100")

    # excise duty
    item_tax = item.addchild("item_tax", "Item Tax")
    item_tax.tax_type = "Excise Duty - %s" % abbr
    item_tax.tax_rate = 10
    item_tax.save()
Пример #5
0
def load_data():
	test_purchase_receipt.load_data()
	
	# create customer group
	webnotes.insert({"doctype": "Customer Group",
		"customer_group_name": "_Test Customer Group",
		"parent_customer_group": "All Customer Groups", "is_group": "No"})
	
	# create customer
	webnotes.insert({"doctype": "Customer", "customer_name": "West Wind Inc.",
		"customer_type": "Company", "territory": "Default",
		"customer_group": "_Test Customer Group", "company": company,
		"credit_days": 50, "credit_limit": 0})
	
	webnotes.insert({"doctype": "Account", "account_name": "_Test Account Sales",
		"parent_account": "Income - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
	
	webnotes.insert({"doctype": "Account", "account_name": "Excise Duty",
		"parent_account": "Tax Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
	
	webnotes.insert({"doctype": "Account", "account_name": "Education Cess",
		"parent_account": "Tax Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
	
	webnotes.insert({"doctype": "Account", "account_name": "S&H Education Cess",
		"parent_account": "Tax Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
		
	webnotes.insert({"doctype": "Account", "account_name": "CST",
		"parent_account": "Direct Expenses - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
		
	webnotes.insert({"doctype": "Account", "account_name": "adj_rate",
		"parent_account": "Direct Expenses - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
		
	from webnotes.model.doc import Document
	item = Document("Item", "Home Desktop 100")
	
	# excise duty
	item_tax = item.addchild("item_tax", "Item Tax")
	item_tax.tax_type = "Excise Duty - %s" % abbr
	item_tax.tax_rate = 10
	item_tax.save()
Пример #6
0
def execute():
	import webnotes
	from webnotes.modules.module_manager import reload_doc
	reload_doc('website', 'doctype', 'website_settings')

	res = webnotes.conn.sql("""\
		SELECT name FROM `tabDocPerm`
		WHERE parent='Website Settings' AND role='All' AND permlevel=1""")
	if not res:
		idx = webnotes.conn.sql("""\
			SELECT MAX(idx) FROM `tabDocPerm`
			WHERE parent='Website Settings'
			""")[0][0]
		from webnotes.model.doc import Document
		d = Document('DocType', 'Website Settings')
		perm = d.addchild('permissions', 'DocPerm')
		perm.read = 1
		perm.role = 'All'
		perm.permlevel = 1
		perm.idx = idx + 1
		perm.save()
Пример #7
0
def execute():
    import webnotes
    from webnotes.modules import reload_doc
    reload_doc('website', 'doctype', 'website_settings')

    res = webnotes.conn.sql("""\
		SELECT name FROM `tabDocPerm`
		WHERE parent='Website Settings' AND role='All' AND permlevel=1""")
    if not res:
        idx = webnotes.conn.sql("""\
			SELECT MAX(idx) FROM `tabDocPerm`
			WHERE parent='Website Settings'
			""")[0][0]
        from webnotes.model.doc import Document
        d = Document('DocType', 'Website Settings')
        perm = d.addchild('permissions', 'DocPerm')
        perm.read = 1
        perm.role = 'All'
        perm.permlevel = 1
        perm.idx = idx + 1
        perm.save()
Пример #8
0
def load_data():
    test_purchase_receipt.load_data()

    # create customer group
    webnotes.insert({
        "doctype": "Customer Group",
        "customer_group_name": "Default Customer Group",
        "parent_customer_group": "All Customer Groups",
        "is_group": "No"
    })

    # create customer
    webnotes.insert({
        "doctype": "Customer",
        "customer_name": "West Wind Inc.",
        "customer_type": "Company",
        "territory": "Default",
        "customer_group": "Default Customer Group",
        "company": company,
        "credit_days": 0,
        "credit_limit": 0
    })

    webnotes.insert({
        "doctype": "Account",
        "account_name": "Excise Duty",
        "parent_account": "Tax Assets - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    webnotes.insert({
        "doctype": "Account",
        "account_name": "Education Cess",
        "parent_account": "Tax Assets - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    webnotes.insert({
        "doctype": "Account",
        "account_name": "S&H Education Cess",
        "parent_account": "Tax Assets - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    webnotes.insert({
        "doctype": "Account",
        "account_name": "CST",
        "parent_account": "Direct Expenses - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    webnotes.insert({
        "doctype": "Account",
        "account_name": "adj_rate",
        "parent_account": "Direct Expenses - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    from webnotes.model.doc import Document
    item = Document("Item", "Home Desktop 100")

    # excise duty
    item_tax = item.addchild("item_tax", "Item Tax")
    item_tax.tax_type = "Excise Duty - %s" % abbr
    item_tax.tax_rate = 10
    item_tax.save()