Пример #1
0
def load_data():
	insert_accounts()
	
	# create default warehouse
	if not webnotes.conn.exists("Warehouse", "Default Warehouse"):
		webnotes.insert({"doctype": "Warehouse", 
			"warehouse_name": "Default Warehouse",
			"warehouse_type": "Stores"})
	
	# create UOM: Nos.
	if not webnotes.conn.exists("UOM", "Nos"):
		webnotes.insert({"doctype": "UOM", "uom_name": "Nos"})
	
	from webnotes.tests import insert_test_data
	# create item groups and items
	insert_test_data("Item Group", 
		sort_fn=lambda ig: (ig[0].get('parent_item_group'), ig[0].get('name')))
	insert_test_data("Item")

	# create supplier type
	webnotes.insert({"doctype": "Supplier Type", "supplier_type": "Manufacturing"})
	
	# create supplier
	webnotes.insert({"doctype": "Supplier", "supplier_name": "East Wind Inc.",
		"supplier_type": "Manufacturing", "company": company})
		
	# create default cost center if not exists
	if not webnotes.conn.exists("Cost Center", "Default Cost Center - %s" % abbr):
		dl = webnotes.insert({"doctype": "Cost Center", "group_or_ledger": "Ledger",
			"cost_center_name": "Default Cost Center", 
			"parent_cost_center": "Root - %s" % abbr,
			"company_name": company, "company_abbr": abbr})
		
	# create account heads for taxes
	
	webnotes.insert({"doctype": "Account", "account_name": "Shipping Charges",
		"parent_account": "Stock Expenses - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
		
	webnotes.insert({"doctype": "Account", "account_name": "Customs Duty",
		"parent_account": "Stock Expenses - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
	webnotes.insert({"doctype": "Account", "account_name": "Tax Assets",
		"parent_account": "Current Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Group"})
	webnotes.insert({"doctype": "Account", "account_name": "VAT - Test",
		"parent_account": "Tax Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
		
	# create BOM
	webnotes.insert([
		{"doctype": "BOM", "item": "Nebula 7", "quantity": 1,
			"is_active": "Yes", "is_default": 1, "uom": "Nos"},
		{"doctype": "BOM Operation", "operation_no": 1, "parentfield": "bom_operations",
			"opn_description": "Development"}, 
		{"doctype": "BOM Item", "item_code": "Android Jack D", "operation_no": 1, 
			"qty": 5, "rate": 20, "amount": 100, "stock_uom": "Nos", 
			"parentfield": "bom_materials"}
	])
Пример #2
0
	def insert_test_data(self):
		# create default warehouse
		if not webnotes.conn.exists("Warehouse", "Default Warehouse"):
			webnotes.insert({"doctype": "Warehouse", 
				"warehouse_name": "Default Warehouse",
				"warehouse_type": "Stores"})

		# create UOM: Nos.
		if not webnotes.conn.exists("UOM", "Nos"):
			webnotes.insert({"doctype": "UOM", "uom_name": "Nos"})
			
		# create item groups and items
		insert_test_data("Item Group", 
			sort_fn=lambda ig: (ig[0].get('parent_item_group'), ig[0].get('name')))
		insert_test_data("Item")
Пример #3
0
def load_data():
	insert_accounts()
	
	# create default warehouse
	if not webnotes.conn.exists("Warehouse", "Default Warehouse"):
		webnotes.insert({"doctype": "Warehouse", 
			"warehouse_name": "Default Warehouse",
			"warehouse_type": "Stores"})
	
	# create UOM: Nos.
	if not webnotes.conn.exists("UOM", "Nos"):
		webnotes.insert({"doctype": "UOM", "uom_name": "Nos"})
	
	from webnotes.tests import insert_test_data
	# create item groups and items
	insert_test_data("Item Group", 
		sort_fn=lambda ig: (ig[0].get('parent_item_group'), ig[0].get('name')))
	insert_test_data("Item")

	# create supplier type
	webnotes.insert({"doctype": "Supplier Type", "supplier_type": "Manufacturing"})
	
	# create supplier
	webnotes.insert({"doctype": "Supplier", "supplier_name": "East Wind Inc.",
		"supplier_type": "Manufacturing", "company": company})
		
	# create default cost center if not exists
	if not webnotes.conn.exists("Cost Center", "Default Cost Center - %s" % abbr):
		webnotes.insert({"doctype": "Cost Center", "group_or_ledger": "Ledger",
			"cost_center_name": "Default Cost Center", 
			"parent_cost_center": "Root - %s" % abbr,
			"company_name": company})
		
	# create account heads for taxes
	
	webnotes.insert({"doctype": "Account", "account_name": "Shipping Charges",
		"parent_account": "Stock Expenses - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
		
	webnotes.insert({"doctype": "Account", "account_name": "Customs Duty",
		"parent_account": "Stock Expenses - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
	webnotes.insert({"doctype": "Account", "account_name": "_Test Tax Assets",
		"parent_account": "Current Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Group"})
	webnotes.insert({"doctype": "Account", "account_name": "VAT - Test",
		"parent_account": "_Test Tax Assets - %s" % abbr, "company": company,
		"group_or_ledger": "Ledger"})
Пример #4
0
    def insert_test_data(self):
        # create default warehouse
        if not webnotes.conn.exists("Warehouse", "Default Warehouse"):
            webnotes.insert({
                "doctype": "Warehouse",
                "warehouse_name": "Default Warehouse",
                "warehouse_type": "Stores"
            })

        # create UOM: Nos.
        if not webnotes.conn.exists("UOM", "Nos"):
            webnotes.insert({"doctype": "UOM", "uom_name": "Nos"})

        # create item groups and items
        insert_test_data("Item Group",
                         sort_fn=lambda ig:
                         (ig[0].get('parent_item_group'), ig[0].get('name')))

        insert_test_data("Item")
Пример #5
0
def load_data():
    insert_accounts()

    # create default warehouse
    if not webnotes.conn.exists("Warehouse", "Default Warehouse"):
        webnotes.insert({
            "doctype": "Warehouse",
            "warehouse_name": "Default Warehouse",
            "warehouse_type": "Stores"
        })

    # create UOM: Nos.
    if not webnotes.conn.exists("UOM", "Nos"):
        webnotes.insert({"doctype": "UOM", "uom_name": "Nos"})

    from webnotes.tests import insert_test_data
    # create item groups and items
    insert_test_data("Item Group",
                     sort_fn=lambda ig:
                     (ig[0].get('parent_item_group'), ig[0].get('name')))
    insert_test_data("Item")

    # create supplier type
    webnotes.insert({
        "doctype": "Supplier Type",
        "supplier_type": "Manufacturing"
    })

    # create supplier
    webnotes.insert({
        "doctype": "Supplier",
        "supplier_name": "East Wind Inc.",
        "supplier_type": "Manufacturing",
        "company": company
    })

    # create default cost center if not exists
    if not webnotes.conn.exists("Cost Center",
                                "Default Cost Center - %s" % abbr):
        dl = webnotes.insert({
            "doctype": "Cost Center",
            "group_or_ledger": "Ledger",
            "cost_center_name": "Default Cost Center",
            "parent_cost_center": "Root - %s" % abbr,
            "company_name": company,
            "company_abbr": abbr
        })

    # create account heads for taxes

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

    webnotes.insert({
        "doctype": "Account",
        "account_name": "Customs Duty",
        "parent_account": "Stock Expenses - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })
    webnotes.insert({
        "doctype": "Account",
        "account_name": "Tax Assets",
        "parent_account": "Current Assets - %s" % abbr,
        "company": company,
        "group_or_ledger": "Group"
    })
    webnotes.insert({
        "doctype": "Account",
        "account_name": "VAT - Test",
        "parent_account": "Tax Assets - %s" % abbr,
        "company": company,
        "group_or_ledger": "Ledger"
    })

    # create BOM
    webnotes.insert([{
        "doctype": "BOM",
        "item": "Nebula 7",
        "quantity": 1,
        "is_active": "Yes",
        "is_default": 1,
        "uom": "Nos"
    }, {
        "doctype": "BOM Operation",
        "operation_no": 1,
        "parentfield": "bom_operations",
        "opn_description": "Development"
    }, {
        "doctype": "BOM Item",
        "item_code": "Android Jack D",
        "operation_no": 1,
        "qty": 5,
        "rate": 20,
        "amount": 100,
        "stock_uom": "Nos",
        "parentfield": "bom_materials"
    }])