[bom] [production] Cleaned up BOM, Production Planning Tool, Progress in Demo Builder

This commit is contained in:
Rushabh Mehta 2013-08-07 17:46:35 +05:30
parent 0cb97f3627
commit 7cfefbced5
10 changed files with 208 additions and 160 deletions

View File

@ -118,6 +118,11 @@ class DocType:
rate = self.get_valuation_rate(arg) rate = self.get_valuation_rate(arg)
elif self.doc.rm_cost_as_per == 'Last Purchase Rate': elif self.doc.rm_cost_as_per == 'Last Purchase Rate':
rate = arg['last_purchase_rate'] rate = arg['last_purchase_rate']
elif self.doc.rm_cost_as_per == "Price List":
if not self.doc.price_list:
webnotes.throw(_("Please select Price List"))
rate = webnotes.conn.get_value("Item Price", {"price_list_name": self.doc.price_list,
"parent": arg["item_code"]}, "ref_rate") or 0
elif self.doc.rm_cost_as_per == 'Standard Rate': elif self.doc.rm_cost_as_per == 'Standard Rate':
rate = arg['standard_rate'] rate = arg['standard_rate']

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-22 15:11:38", "creation": "2013-01-22 15:11:38",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-22 15:28:38", "modified": "2013-08-07 17:09:46",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -66,11 +66,6 @@
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
{
"doctype": "DocField",
"fieldname": "cb0",
"fieldtype": "Column Break"
},
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"default": "1", "default": "1",
@ -87,6 +82,7 @@
}, },
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"default": "1",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "is_default", "fieldname": "is_default",
"fieldtype": "Check", "fieldtype": "Check",
@ -96,6 +92,11 @@
"oldfieldname": "is_default", "oldfieldname": "is_default",
"oldfieldtype": "Check" "oldfieldtype": "Check"
}, },
{
"doctype": "DocField",
"fieldname": "cb0",
"fieldtype": "Column Break"
},
{ {
"description": "Manage cost of operations", "description": "Manage cost of operations",
"doctype": "DocField", "doctype": "DocField",
@ -103,6 +104,22 @@
"fieldtype": "Check", "fieldtype": "Check",
"label": "With Operations" "label": "With Operations"
}, },
{
"doctype": "DocField",
"fieldname": "rm_cost_as_per",
"fieldtype": "Select",
"label": "Rate Of Materials Based On",
"options": "Valuation Rate\nLast Purchase Rate\nPrice List"
},
{
"depends_on": "eval:doc.rm_cost_as_per===\"Price List\"",
"description": "Price List for Costing",
"doctype": "DocField",
"fieldname": "price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List"
},
{ {
"depends_on": "with_operations", "depends_on": "with_operations",
"doctype": "DocField", "doctype": "DocField",
@ -145,13 +162,6 @@
"label": "Costing", "label": "Costing",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break"
}, },
{
"doctype": "DocField",
"fieldname": "rm_cost_as_per",
"fieldtype": "Select",
"label": "Rate Of Materials Based On",
"options": "Valuation Rate\nLast Purchase Rate"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "total_cost", "fieldname": "total_cost",

View File

@ -2,8 +2,8 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
cur_frm.cscript.onload = function(doc, cdt, cdn) { cur_frm.cscript.onload = function(doc, cdt, cdn) {
doc.company = wn.defaults.get_default("company"); cur_frm.set_value("company", wn.defaults.get_default("company"))
refresh_field("company"); cur_frm.set_value("use_multi_level_bom", 1)
} }
cur_frm.cscript.refresh = function(doc) { cur_frm.cscript.refresh = function(doc) {

View File

@ -148,6 +148,7 @@ class DocType:
def validate_data(self): def validate_data(self):
self.validate_company()
for d in getlist(self.doclist, 'pp_details'): for d in getlist(self.doclist, 'pp_details'):
self.validate_bom_no(d) self.validate_bom_no(d)
if not flt(d.planned_qty): if not flt(d.planned_qty):
@ -169,7 +170,6 @@ class DocType:
def raise_production_order(self): def raise_production_order(self):
"""It will raise production order (Draft) for all distinct FG items""" """It will raise production order (Draft) for all distinct FG items"""
self.validate_company()
self.validate_data() self.validate_data()
from utilities.transaction_base import validate_uom_is_integer from utilities.transaction_base import validate_uom_is_integer
@ -180,9 +180,9 @@ class DocType:
if pro: if pro:
pro = ["""<a href="#Form/Production Order/%s" target="_blank">%s</a>""" % \ pro = ["""<a href="#Form/Production Order/%s" target="_blank">%s</a>""" % \
(p, p) for p in pro] (p, p) for p in pro]
msgprint("Following Production Order has been generated:\n" + '\n'.join(pro)) msgprint("Production Order(s) created:\n\n" + '\n'.join(pro))
else : else :
msgprint("No Production Order generated.") msgprint("No Production Order created.")
def get_distinct_items_and_boms(self): def get_distinct_items_and_boms(self):
@ -223,6 +223,7 @@ class DocType:
def download_raw_materials(self): def download_raw_materials(self):
""" Create csv data for required raw material to produce finished goods""" """ Create csv data for required raw material to produce finished goods"""
self.validate_data()
bom_dict = self.get_distinct_items_and_boms()[0] bom_dict = self.get_distinct_items_and_boms()[0]
self.get_raw_materials(bom_dict) self.get_raw_materials(bom_dict)
return self.get_csv() return self.get_csv()
@ -283,6 +284,7 @@ class DocType:
Raise Material Request if projected qty is less than qty required Raise Material Request if projected qty is less than qty required
Requested qty should be shortage qty considering minimum order qty Requested qty should be shortage qty considering minimum order qty
""" """
self.validate_data()
if not self.doc.purchase_request_for_warehouse: if not self.doc.purchase_request_for_warehouse:
webnotes.msgprint("Please enter Warehouse for which Material Request will be raised", webnotes.msgprint("Please enter Warehouse for which Material Request will be raised",
raise_exception=1) raise_exception=1)
@ -308,6 +310,7 @@ class DocType:
def get_projected_qty(self): def get_projected_qty(self):
items = self.item_dict.keys() items = self.item_dict.keys()
item_projected_qty = webnotes.conn.sql("""select item_code, sum(projected_qty) item_projected_qty = webnotes.conn.sql("""select item_code, sum(projected_qty)
from `tabBin` where item_code in (%s) group by item_code""" % from `tabBin` where item_code in (%s) group by item_code""" %
(", ".join(["%s"]*len(items)),), tuple(items)) (", ".join(["%s"]*len(items)),), tuple(items))
@ -355,7 +358,7 @@ class DocType:
if purchase_request_list: if purchase_request_list:
pur_req = ["""<a href="#Form/Material Request/%s" target="_blank">%s</a>""" % \ pur_req = ["""<a href="#Form/Material Request/%s" target="_blank">%s</a>""" % \
(p, p) for p in purchase_request_list] (p, p) for p in purchase_request_list]
webnotes.msgprint("Following Material Request created successfully: \n%s" % webnotes.msgprint("Material Request(s) created: \n%s" %
"\n".join(pur_req)) "\n".join(pur_req))
else: else:
webnotes.msgprint("Nothing to request") webnotes.msgprint("Nothing to request")

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-21 12:03:47", "creation": "2013-01-21 12:03:47",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-22 15:26:45", "modified": "2013-08-07 17:21:19",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "jai@webnotestech.com" "owner": "jai@webnotestech.com"
}, },
@ -118,46 +118,17 @@
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "clear_so_table", "fieldname": "items_for_production",
"fieldtype": "Button",
"label": "Clear Table",
"options": "clear_so_table"
},
{
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
"doctype": "DocField",
"fieldname": "create_production_orders",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Create Production Orders" "label": "Select Items"
}, },
{ {
"description": "Pull items from Sales Order mentioned in the above table.",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "get_items_from_so", "fieldname": "get_items_from_so",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Get Items", "label": "Get Items From Sales Orders",
"options": "get_items_from_so" "options": "get_items_from_so"
}, },
{
"doctype": "DocField",
"fieldname": "pp_details",
"fieldtype": "Table",
"label": "Production Plan Items",
"options": "Production Plan Item"
},
{
"doctype": "DocField",
"fieldname": "clear_item_table",
"fieldtype": "Button",
"label": "Clear Table",
"options": "clear_item_table"
},
{
"doctype": "DocField",
"fieldname": "section_break3",
"fieldtype": "Section Break",
"options": "Simple"
},
{ {
"default": "1", "default": "1",
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.", "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
@ -169,36 +140,31 @@
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "cb5", "fieldname": "pp_details",
"fieldtype": "Column Break", "fieldtype": "Table",
"width": "50%" "label": "Production Plan Items",
"options": "Production Plan Item"
},
{
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
"doctype": "DocField",
"fieldname": "create_production_orders",
"fieldtype": "Section Break",
"label": "Production Orders"
}, },
{ {
"description": "Separate production order will be created for each finished good item.", "description": "Separate production order will be created for each finished good item.",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "raise_production_order", "fieldname": "raise_production_order",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Raise Production Order", "label": "Create Production Orders",
"options": "raise_production_order" "options": "raise_production_order"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "sb5", "fieldname": "sb5",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Materials Requirement Planning (MRP)" "label": "Material Requirement"
},
{
"description": "Download a report containing all raw materials with their latest inventory status",
"doctype": "DocField",
"fieldname": "download_materials_required",
"fieldtype": "Button",
"label": "Download Materials Required"
},
{
"doctype": "DocField",
"fieldname": "column_break6",
"fieldtype": "Column Break",
"width": "50%"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -212,9 +178,16 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "raise_purchase_request", "fieldname": "raise_purchase_request",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Raise Material Request", "label": "Create Material Requests",
"options": "raise_purchase_request" "options": "raise_purchase_request"
}, },
{
"description": "Download a report containing all raw materials with their latest inventory status",
"doctype": "DocField",
"fieldname": "download_materials_required",
"fieldtype": "Button",
"label": "Download Materials Required"
},
{ {
"doctype": "DocPerm" "doctype": "DocPerm"
} }

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-05-24 19:29:08", "creation": "2013-05-24 19:29:08",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-26 11:16:53", "modified": "2013-08-07 16:20:21",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -728,6 +728,7 @@
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1,
"label": "Status", "label": "Status",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "status", "oldfieldname": "status",

View File

@ -107,6 +107,7 @@ def import_defaults():
{'doctype': 'Item Group', 'item_group_name': 'Products', 'is_group': 'No', 'parent_item_group': 'All Item Groups'}, {'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': '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': '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'},
# deduction type # deduction type
{'doctype': 'Deduction Type', 'name': 'Income Tax', 'description': 'Income Tax', 'deduction_name': 'Income Tax'}, {'doctype': 'Deduction Type', 'name': 'Income Tax', 'description': 'Income Tax', 'deduction_name': 'Income Tax'},

View File

@ -0,0 +1,48 @@
"Data Import Template"
"Table:","BOM"
""
""
"Notes:"
"Please do not change the template headings."
"First data column must be blank."
"If you are uploading new records, leave the ""name"" (ID) column blank."
"If you are uploading new records, ""Naming Series"" becomes mandatory, if present."
"Only mandatory fields are necessary for new records. You can delete non-mandatory columns if you wish."
"For updating, you can update only selective columns."
"You can only upload upto 5000 records in one go. (may be less in some cases)"
""
"DocType:","BOM","","","","","","","","","","","","","","","","-","BOM Operation","bom_operations","","","","","","-","BOM Item","bom_materials","","","","","","","","","-","BOM Explosion Item","flat_bom_details","","","","","",""
"Column Labels:","ID","Last Updated On","Item","Quantity","Is Active","Is Default","With Operations","Rate Of Materials Based On","Price List","Total Cost","Total Raw Material Cost","Total Operating Cost","Item UOM","Project Name","Item Desription","Amended From","-","ID","Operation No","Operation Description","Workstation","Hour Rate","Operation Time (mins)","Operating Cost","-","ID","Item Code","Qty","Stock UOM","Operation No","BOM No","Rate","Amount","Scrap %","Item Description","-","ID","Item Code","Description","Qty","Rate","Amount","Stock UOM","Qty Consumed Per Unit"
"Column Name:","name","modified","item","quantity","is_active","is_default","with_operations","rm_cost_as_per","price_list","total_cost","raw_material_cost","operating_cost","uom","project_name","description","amended_from","-","name","operation_no","opn_description","workstation","hour_rate","time_in_mins","operating_cost","-","name","item_code","qty","stock_uom","operation_no","bom_no","rate","amount","scrap","description","-","name","item_code","description","qty","rate","amount","stock_uom","qty_consumed_per_unit"
"Mandatory:","Yes","Yes","Yes","Yes","No","No","No","No","No","No","No","No","No","No","No","No","-","Yes","Yes","Yes","No","No","No","No","-","Yes","Yes","Yes","Yes","No","No","No","No","No","No","-","Yes","No","No","No","No","No","No","No"
"Type:","Data (text)","Data","Link","Float","Check","Check","Check","Select","Link","Float","Float","Float","Select","Link","Small Text","Link","-","Data","Data","Text","Link","Float","Float","Float","-","Data","Link","Float","Link","Select","Link","Float","Float","Float","Text","-","Data","Link","Text","Float","Float","Float","Link","Float"
"Info:","","Don't change!","Valid Item","","0 or 1","0 or 1","0 or 1","One of: Valuation Rate, Last Purchase Rate, Price List","Valid Price List","","","","Valid UOM","Valid Project","","Valid BOM","-","Leave blank for new records","","","Valid Workstation","","","","-","Leave blank for new records","Valid Item","","Valid UOM","","Valid BOM","","","","","-","Leave blank for new records","Valid Item","","","","","Valid UOM",""
"Start entering data below this line"
"","BOM/Bearing Assembly/001","""2013-08-07 16:58:00""","Bearing Assembly",1.0,1,"","","Price List","Standard Buying",130.0,130.0,0.0,"Nos","","Bearing Assembly","","","","","","","","","","","000000183","Base Bearing Plate",1.0,"Nos","","",15.0,15.0,"","1/4 in. x 6 in. x 6 in. Mild Steel Plate","","FBD/000039","Bearing Pipe","1.5 in. Diameter x 36 in. Mild Steel Tubing",1.0,15.0,15.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000184","Bearing Block",1.0,"Nos","","",10.0,10.0,"","CAST IRON, MCMASTER PART NO. 3710T13","","FBD/000040","Bearing Collar","1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar",2.0,20.0,40.0,"Nos",2.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000185","Bearing Collar",2.0,"Nos","","",20.0,40.0,"","1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar","","FBD/000041","Bearing Block","CAST IRON, MCMASTER PART NO. 3710T13",1.0,10.0,10.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000186","Bearing Pipe",1.0,"Nos","","",15.0,15.0,"","1.5 in. Diameter x 36 in. Mild Steel Tubing","","FBD/000042","Upper Bearing Plate","3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate",1.0,50.0,50.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000187","Upper Bearing Plate",1.0,"Nos","","",50.0,50.0,"","3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate","","FBD/000043","Base Bearing Plate","1/4 in. x 6 in. x 6 in. Mild Steel Plate",1.0,15.0,15.0,"Nos",1.0
"","BOM/Wind Mill A Series/001","""2013-08-07 16:47:02""","Wind Mill A Series",1.0,1,"","","Price List","Standard Buying",223.0,223.0,0.0,"Nos","","Wind Mill A Series for Home Use 9ft","","","","","","","","","","","000000163","Base Bearing Plate",1.0,"Nos","","",15.0,15.0,"","1/4 in. x 6 in. x 6 in. Mild Steel Plate","","FBD/000008","Shaft","1.25 in. Diameter x 6 ft. Mild Steel Tubing",1.0,30.0,30.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000164","Base Plate",1.0,"Nos","","",20.0,20.0,"","3/4 in. x 2 ft. x 4 ft. Pine Plywood","","FBD/000009","Base Bearing Plate","1/4 in. x 6 in. x 6 in. Mild Steel Plate",1.0,15.0,15.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000165","Bearing Block",1.0,"Nos","","",10.0,10.0,"","CAST IRON, MCMASTER PART NO. 3710T13","","FBD/000010","External Disc","15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing",1.0,45.0,45.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000166","Bearing Pipe",1.0,"Nos","","",15.0,15.0,"","1.5 in. Diameter x 36 in. Mild Steel Tubing","","FBD/000011","Bearing Pipe","1.5 in. Diameter x 36 in. Mild Steel Tubing",1.0,15.0,15.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000167","External Disc",1.0,"Nos","","",45.0,45.0,"","15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing","","FBD/000012","Wing Sheet","1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet",4.0,22.0,88.0,"Nos",4.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000168","Shaft",1.0,"Nos","","",30.0,30.0,"","1.25 in. Diameter x 6 ft. Mild Steel Tubing","","FBD/000013","Base Plate","3/4 in. x 2 ft. x 4 ft. Pine Plywood",1.0,20.0,20.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000169","Wing Sheet",4.0,"Nos","","",22.0,88.0,"","1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet","","FBD/000014","Bearing Block","CAST IRON, MCMASTER PART NO. 3710T13",1.0,10.0,10.0,"Nos",1.0
"","BOM/Wind MIll C Series/001","""2013-08-07 16:58:51""","Wind MIll C Series",1.0,1,"","","Price List","Standard Buying",314.0,314.0,0.0,"Nos","","Wind Mill C Series for Commercial Use 18ft","","","","","","","","","","","000000176","Base Plate",2.0,"Nos","","",20.0,40.0,"","3/4 in. x 2 ft. x 4 ft. Pine Plywood","","FBD/000061","Base Bearing Plate","1/4 in. x 6 in. x 6 in. Mild Steel Plate",1.0,15.0,15.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000178","Internal Disc",1.0,"Nos","","",33.0,33.0,"","For Bearing Collar","","FBD/000062","Bearing Collar","1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar",2.0,20.0,40.0,"Nos",2.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000179","External Disc",1.0,"Nos","","",45.0,45.0,"","15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing","","FBD/000063","Base Plate","3/4 in. x 2 ft. x 4 ft. Pine Plywood",2.0,20.0,40.0,"Nos",2.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000188","Bearing Assembly",1.0,"Nos","","BOM/Bearing Assembly/001",130.0,130.0,"","Bearing Assembly","","FBD/000064","Bearing Pipe","1.5 in. Diameter x 36 in. Mild Steel Tubing",1.0,15.0,15.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000189","Wing Sheet",3.0,"Nos","","",22.0,66.0,"","1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet","","FBD/000065","Internal Disc","For Bearing Collar",1.0,33.0,33.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","FBD/000066","Upper Bearing Plate","3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate",1.0,50.0,50.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","FBD/000067","Wing Sheet","1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet",3.0,22.0,66.0,"Nos",3.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","FBD/000068","External Disc","15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing",1.0,45.0,45.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","FBD/000069","Bearing Block","CAST IRON, MCMASTER PART NO. 3710T13",1.0,10.0,10.0,"Nos",1.0
"","BOM/Wind Turbine/001","""2013-08-07 16:51:56""","Wind Turbine",1.0,1,"","","Price List","Standard Buying",139.0,139.0,0.0,"Nos","","Small Wind Turbine for Home Use","","","","","","","","","","","000000170","Base Bearing Plate",1.0,"Nos","","",15.0,15.0,"","1/4 in. x 6 in. x 6 in. Mild Steel Plate","","FBD/000021","Shaft","1.25 in. Diameter x 6 ft. Mild Steel Tubing",1.0,30.0,30.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000171","Base Plate",1.0,"Nos","","",20.0,20.0,"","3/4 in. x 2 ft. x 4 ft. Pine Plywood","","FBD/000022","Bearing Collar","1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar",1.0,20.0,20.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000172","Bearing Collar",1.0,"Nos","","",20.0,20.0,"","1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar","","FBD/000023","Base Plate","3/4 in. x 2 ft. x 4 ft. Pine Plywood",1.0,20.0,20.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000173","Blade Rib",1.0,"Nos","","",10.0,10.0,"","1/2 in. x 2 ft. x 4 ft. Pine Plywood","","FBD/000024","Base Bearing Plate","1/4 in. x 6 in. x 6 in. Mild Steel Plate",1.0,15.0,15.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000174","Shaft",1.0,"Nos","","",30.0,30.0,"","1.25 in. Diameter x 6 ft. Mild Steel Tubing","","FBD/000025","Blade Rib","1/2 in. x 2 ft. x 4 ft. Pine Plywood",1.0,10.0,10.0,"Nos",1.0
"","","","","","","","","","","","","","","","","","","","","","","","","","","000000175","Wing Sheet",2.0,"Nos","","",22.0,44.0,"","1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet","","FBD/000026","Wing Sheet","1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet",2.0,22.0,44.0,"Nos",2.0
Can't render this file because it has a wrong number of fields in line 2.

View File

@ -1,36 +1,38 @@
Data Import Template,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "Data Import Template"
Table:,Item,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "Table:","Item"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ""
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ""
Notes:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "Notes:"
Please do not change the template headings.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "Please do not change the template headings."
First data column must be blank.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "First data column must be blank."
Only mandatory fields are necessary for new records. You can delete non-mandatory columns if you wish.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "If you are uploading new records, leave the ""name"" (ID) column blank."
"For updating, you can update only selective columns.",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "If you are uploading new records, ""Naming Series"" becomes mandatory, if present."
"If you are uploading new records, leave the ""name"" (ID) column blank.",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "Only mandatory fields are necessary for new records. You can delete non-mandatory columns if you wish."
"If you are uploading new records, ""Naming Series"" becomes mandatory, if present.",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "For updating, you can update only selective columns."
You can only upload upto 5000 records in one go. (may be less in some cases),,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "You can only upload upto 5000 records in one go. (may be less in some cases)"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ""
Column Labels,ID,Is Service Item,Is Asset Item,Is Sub Contracted Item,Item Name,Is Sales Item,Default Unit of Measure,Allow Production Order,Allow Bill of Materials,Description,Is Stock Item,Inspection Required,Is Purchase Item,Item Group,Has Batch No,Has Serial No,Allow Samples,Item Code,Default Reserved Warehouse,Cost Center,Last Purchase Rate,Default BOM,Naming Series,Image,Valuation Method,Image,Weightage,Net Weight,Max Discount (%),Warranty Period (in days),Default Cost Center,Re-Order Level,Default Income Account,Default Expense Account,Description HTML,Show in Website,End of Life,Website Warehouse,Manufacturer Part Number,Page Name,Manufacturer,Allowance Percent,Brand,Barcode,Slideshow,Re-Order Qty,Weight UOM,Minimum Order Qty,Lead Time Days,Website Description,Standard Rate "DocType:","Item","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
Column Name:,name,is_service_item,is_asset_item,is_sub_contracted_item,item_name,is_sales_item,stock_uom,is_pro_applicable,is_manufactured_item,description,is_stock_item,inspection_required,is_purchase_item,item_group,has_batch_no,has_serial_no,is_sample_item,item_code,default_warehouse,default_sales_cost_center,last_purchase_rate,default_bom,naming_series,image,valuation_method,website_image,weightage,net_weight,max_discount,warranty_period,cost_center,re_order_level,default_income_account,purchase_account,description_html,show_in_website,end_of_life,website_warehouse,manufacturer_part_no,page_name,manufacturer,tolerance,brand,barcode,slideshow,re_order_qty,weight_uom,min_order_qty,lead_time_days,web_long_description,standard_rate "Column Labels:","ID","Item Name","Item Group","Default Unit of Measure","Description","Is Stock Item","Is Asset Item","Has Batch No","Has Serial No","Is Purchase Item","Is Sales Item","Is Service Item","Allow Samples","Inspection Required","Allow Bill of Materials","Allow Production Order","Is Sub Contracted Item","Naming Series","Item Code","Brand","Barcode","Image","Description HTML","Default Warehouse","Allowance Percent","Valuation Method","Minimum Order Qty","Warranty Period (in days)","End of Life","Net Weight","Weight UOM","Re-Order Level","Re-Order Qty","Default Supplier","Lead Time Days","Default Expense Account","Default Cost Center","Last Purchase Rate","Standard Rate","Manufacturer","Manufacturer Part Number","Max Discount (%)","Default Income Account","Cost Center","Default BOM","Show in Website","Page Name","Weightage","Slideshow","Image","Website Warehouse","Website Description"
Mandatory:,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,Yes,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No "Column Name:","name","item_name","item_group","stock_uom","description","is_stock_item","is_asset_item","has_batch_no","has_serial_no","is_purchase_item","is_sales_item","is_service_item","is_sample_item","inspection_required","is_manufactured_item","is_pro_applicable","is_sub_contracted_item","naming_series","item_code","brand","barcode","image","description_html","default_warehouse","tolerance","valuation_method","min_order_qty","warranty_period","end_of_life","net_weight","weight_uom","re_order_level","re_order_qty","default_supplier","lead_time_days","purchase_account","cost_center","last_purchase_rate","standard_rate","manufacturer","manufacturer_part_no","max_discount","default_income_account","default_sales_cost_center","default_bom","show_in_website","page_name","weightage","slideshow","website_image","website_warehouse","web_long_description"
Type:,Data (text),Select,Select,Select,Data,Select,Link,Select,Select,Small Text,Select,Select,Select,Link,Select,Select,Select,Data,Link,Link,Float,Link,Select,Select,Select,Select,Int,Float,Float,Data,Link,Float,Link,Link,Small Text,Check,Date,Link,Data,Data,Data,Float,Link,Data,Link,Float,Link,Float,Int,Text Editor,Float "Mandatory:","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","Yes","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No","No"
Info:,,"One of: Yes, No","One of: Yes, No","One of: Yes, No",,"One of: Yes, No",Valid UOM,"One of: Yes, No","One of: Yes, No",,"One of: Yes, No","One of: Yes, No","One of: Yes, No",Valid Item Group,"One of: Yes, No","One of: Yes, No","One of: Yes, No",,Valid Warehouse,Valid Cost Center,,Valid BOM,One of: ITEM,One of: attach_files:,"One of: FIFO, Moving Average",One of: attach_files:,Integer,,,,Valid Cost Center,,Valid Account,Valid Account,,0 or 1,,Valid Warehouse,,,,,Valid Brand,,Valid Website Slideshow,,Valid UOM,,Integer,, "Type:","Data (text)","Data","Link","Link","Small Text","Select","Select","Select","Select","Select","Select","Select","Select","Select","Select","Select","Select","Select","Data","Link","Data","Select","Small Text","Link","Float","Select","Float","Data","Date","Float","Link","Float","Float","Link","Int","Link","Link","Float","Float","Data","Data","Float","Link","Link","Link","Check","Data","Int","Link","Select","Link","Text Editor"
Start entering data below this line,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "Info:","","","Valid Item Group","Valid UOM","","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: Yes, No","One of: ITEM","","Valid Brand","","One of: attach_files:","","Valid Warehouse","","One of: FIFO, Moving Average","","","","","Valid UOM","","","Valid Supplier","Integer","Valid Account","Valid Cost Center","","","","","","Valid Account","Valid Cost Center","Valid BOM","0 or 1","","Integer","Valid Website Slideshow","One of: attach_files:","Valid Warehouse",""
,Wind Turbine,Yes,No,No,Wind Turbine,Yes,Nos,Yes,Yes,Small Wind Turbine for Home Use,Yes,No,Yes,Products,No,No,No,Wind Turbine,Finished Goods - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "Start entering data below this line"
,Wind Mill A Series,Yes,No,No,Wind Mill A Series,Yes,Nos,Yes,Yes,Wind Mill A Series for Home Use 9ft,Yes,No,Yes,Products,No,Yes,No,Wind Mill A Series,Finished Goods - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Base Bearing Plate","Base Bearing Plate","Raw Material","Nos","1/4 in. x 6 in. x 6 in. Mild Steel Plate","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Base Bearing Plate","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Wind Mill A Series,Yes,No,No,Wind Mill A Series,Yes,Nos,Yes,Yes,Wind Mill A Series for Home Use 12ft,Yes,No,Yes,Products,No,Yes,No,Wind Mill A Series,Finished Goods - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Base Plate","Base Plate","Raw Material","Nos","3/4 in. x 2 ft. x 4 ft. Pine Plywood","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Base Plate","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Wind MIll C Series,Yes,No,No,Wind MIll C Series,Yes,Nos,Yes,Yes,Wind Mill C Series for Commercial Use 18ft,Yes,No,Yes,Products,No,Yes,No,Wind MIll C Series,Finished Goods - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Bearing Assembly","Bearing Assembly","Sub Assemblies","Nos","Bearing Assembly","Yes","No","No","No","No","Yes","No","No","No","Yes","Yes","No","","Bearing Assembly","","","","","Stores - WP","","",0.0,"","","","","","","","","","","","","","","","","","","","","","","","",""
,Base Plate,Yes,No,No,Base Plate,Yes,Nos,Yes,No,3/4 in. x 2 ft. x 4 ft. Pine Plywood,Yes,No,Yes,Raw Material,No,No,No,Base Plate,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Bearing Block","Bearing Block","Raw Material","Nos","CAST IRON, MCMASTER PART NO. 3710T13","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Bearing Block","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Base Bearing Plate,Yes,No,No,Base Bearing Plate,Yes,Nos,Yes,No,1/4 in. x 6 in. x 6 in. Mild Steel Plate,Yes,No,Yes,Raw Material,No,No,No,Base Bearing Plate,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Bearing Collar","Bearing Collar","Raw Material","Nos","1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Bearing Collar","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Bearing Pipe,Yes,No,No,Bearing Pipe,Yes,Nos,Yes,No,1.5 in. Diameter x 36 in. Mild Steel Tubing,Yes,No,Yes,Raw Material,No,No,No,Bearing Pipe,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Bearing Pipe","Bearing Pipe","Raw Material","Nos","1.5 in. Diameter x 36 in. Mild Steel Tubing","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Bearing Pipe","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Upper Bearing Plate,Yes,No,No,Upper Bearing Plate,Yes,Nos,Yes,No,3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate,Yes,No,Yes,Raw Material,No,No,No,Upper Bearing Plate,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Blade Rib","Blade Rib","Raw Material","Nos","1/2 in. x 2 ft. x 4 ft. Pine Plywood","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Blade Rib","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Bearing Collar,Yes,No,No,Bearing Collar,Yes,Nos,Yes,No,1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar ,Yes,No,Yes,Raw Material,No,No,No,Bearing Collar,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Disc Collars","Disc Collars","Raw Material","Nos","For Upper Bearing","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Disc Collars","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,External Disc,Yes,No,No,External Disc,Yes,Nos,Yes,No,15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing ,Yes,No,Yes,Raw Material,No,No,No,External Disc,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","External Disc","External Disc","Raw Material","Nos","15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","External Disc","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Shaft,Yes,No,No,Shaft,Yes,Nos,Yes,No,1.25 in. Diameter x 6 ft. Mild Steel Tubing,Yes,No,Yes,Raw Material,No,No,No,Shaft,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Internal Disc","Internal Disc","Raw Material","Nos","For Bearing Collar","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Internal Disc","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Internal Disc,Yes,No,No,Internal Disc,Yes,Nos,Yes,No,For Bearing Collar,Yes,No,Yes,Raw Material,No,No,No,Internal Disc,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Shaft","Shaft","Raw Material","Nos","1.25 in. Diameter x 6 ft. Mild Steel Tubing","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Shaft","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Blade Rib,Yes,No,No,Blade Rib,Yes,Nos,Yes,No,1/2 in. x 2 ft. x 4 ft. Pine Plywood,Yes,No,Yes,Raw Material,No,No,No,Blade Rib,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Stand","Stand","Raw Material","Nos","N/A","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Stand","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Wing Sheet,Yes,No,No,Wing Sheet,Yes,Nos,Yes,No,1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet,Yes,No,Yes,Raw Material,No,No,No,Wing Sheet,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Upper Bearing Plate","Upper Bearing Plate","Raw Material","Nos","3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Upper Bearing Plate","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Disc Collars,Yes,No,No,Disc Collars,Yes,Nos,Yes,No,For Upper Bearing,Yes,No,Yes,Raw Material,No,No,No,Disc Collars,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Wind Mill A Series","Wind Mill A Series","Products","Nos","Wind Mill A Series for Home Use 9ft","Yes","No","No","Yes","Yes","Yes","Yes","No","No","Yes","Yes","No","","Wind Mill A Series","","","","","Finished Goods - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Bearing Block,Yes,No,No,Bearing Block,Yes,Nos,Yes,No,"CAST IRON, MCMASTER PART NO. 3710T13",Yes,No,Yes,Raw Material,No,No,No,Bearing Block,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Wind MIll C Series","Wind MIll C Series","Products","Nos","Wind Mill C Series for Commercial Use 18ft","Yes","No","No","Yes","Yes","Yes","Yes","No","No","Yes","Yes","No","","Wind MIll C Series","","","","","Finished Goods - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,Stand,Yes,No,No,Stand,Yes,Nos,Yes,No,N/A,Yes,No,Yes,Raw Material,No,No,No,Stand,Stores - WP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, "","Wind Turbine","Wind Turbine","Products","Nos","Small Wind Turbine for Home Use","Yes","No","No","No","Yes","Yes","Yes","No","No","Yes","Yes","No","","Wind Turbine","","","","","Finished Goods - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","Wing Sheet","Wing Sheet","Raw Material","Nos","1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Wing Sheet","","","","","Stores - WP","","","","","","","","","","","","","","","","","","","","","","","","","","","",""

Can't render this file because it has a wrong number of fields in line 2.

View File

@ -8,10 +8,12 @@ import random
webnotes.session = webnotes._dict({"user":"Administrator"}) webnotes.session = webnotes._dict({"user":"Administrator"})
from core.page.data_import_tool.data_import_tool import upload from core.page.data_import_tool.data_import_tool import upload
company = "Wind Power LLC"
start_date = '2010-01-01' start_date = '2010-01-01'
runs_for = 100 runs_for = 100
prob = { prob = {
"Quotation": 0.5 "Quotation": { "make": 0.5, "qty": (1,3) },
"Sales Order": { "make": 0.5, "qty": (1,2) }
} }
def make(): def make():
@ -20,9 +22,7 @@ def make():
webnotes.mute_emails = True webnotes.mute_emails = True
# setup() # setup()
# simulate() simulate()
make_quotation("2010-01-01")
webnotes.conn.commit()
def setup(): def setup():
install() install()
@ -30,13 +30,13 @@ def setup():
make_items() make_items()
make_customers_suppliers_contacts() make_customers_suppliers_contacts()
make_users_and_employees() make_users_and_employees()
# make_bom()
# make_opening_stock() # make_opening_stock()
# make_opening_accounts() # make_opening_accounts()
def simulate(): def simulate():
current_date = None current_date = None
for i in xrange(runs_for): for i in xrange(runs_for):
print i
if not current_date: if not current_date:
current_date = webnotes.utils.getdate(start_date) current_date = webnotes.utils.getdate(start_date)
else: else:
@ -46,14 +46,34 @@ def simulate():
continue continue
run_sales(current_date) run_sales(current_date)
run_purchase(current_date)
run_manufacturing(current_date)
webnotes.conn.commit() webnotes.conn.commit()
def run_sales(current_date): def run_sales(current_date):
if random.random() < prob["Quotation"]: if random.random() < prob["Quotation"]["make"]:
for i in xrange(random.randrange(*prob["Quotation"]["qty"])):
make_quotation(current_date) make_quotation(current_date)
if random.random() < prob["Sales Order"]["make"]:
for i in xrange(random.randrange(*prob["Sales Order"]["qty"])):
make_sales_order(current_date)
def run_purchase(current_date):
pass
def run_manufacturing(current_date):
ppt = webnotes.bean("Production Planning Tool", "Production Planning Tool")
ppt.doc.company = company
ppt.doc.use_multi_level_bom = 1
ppt.doc.purchase_request_for_warehouse = "Stores - WP"
ppt.run_method("get_open_sales_orders")
ppt.run_method("get_items_from_so")
ppt.run_method("get_items_from_so")
ppt.run_method("raise_production_order")
ppt.run_method("raise_purchase_request")
def make_quotation(current_date): def make_quotation(current_date):
b = webnotes.bean([{ b = webnotes.bean([{
"creation": current_date, "creation": current_date,
@ -75,7 +95,16 @@ def make_quotation(current_date):
}, unique="item_code") }, unique="item_code")
b.insert() b.insert()
print b.doc.name b.submit()
def make_sales_order(current_date):
q = get_random("Quotation", {"status": "Submitted"})
from selling.doctype.quotation.quotation import make_sales_order
so = webnotes.bean(make_sales_order(q))
so.doc.transaction_date = current_date
so.doc.delivery_date = webnotes.utils.add_days(current_date, 10)
so.insert()
so.submit()
def add_random_children(bean, template, rows, randomize, unique=None): def add_random_children(bean, template, rows, randomize, unique=None):
for i in xrange(random.randrange(1, rows)): for i in xrange(random.randrange(1, rows)):
@ -92,8 +121,6 @@ def add_random_children(bean, template, rows, randomize, unique=None):
else: else:
bean.doclist.append(d) bean.doclist.append(d)
def get_random(doctype, filters=None): def get_random(doctype, filters=None):
condition = [] condition = []
if filters: if filters:
@ -122,56 +149,34 @@ def complete_setup():
"last_name": "User", "last_name": "User",
"fy_start": "1st Jan", "fy_start": "1st Jan",
"industry": "Manufacturing", "industry": "Manufacturing",
"company_name": "Wind Power LLC", "company_name": company,
"company_abbr": "WP", "company_abbr": "WP",
"currency": "USD", "currency": "USD",
"timezone": "America/New York", "timezone": "America/New York",
"country": "United States" "country": "United States"
}) })
print "Importing Fiscal Years..." import_data("Fiscal_Year")
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Fiscal_Year.csv")
upload()
def make_items(): def make_items():
print "Importing Items..." import_data(["Item", "Item_Price", "BOM"])
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Item.csv")
upload()
print "Importing Item Prices..."
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Item_Price.csv")
upload()
def make_customers_suppliers_contacts(): def make_customers_suppliers_contacts():
print "Importing Customers..." import_data(["Customer", "Supplier", "Contact", "Address", "Lead"])
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Customer.csv")
upload()
print "Importing Suppliers..."
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Supplier.csv")
upload()
print "Importing Contacts..."
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Contact.csv")
upload()
print "Importing Address..."
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Address.csv")
upload()
print "Importing Lead..."
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Lead.csv")
upload()
def make_users_and_employees(): def make_users_and_employees():
print "Importing Profile..."
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Profile.csv")
upload()
webnotes.conn.set_value("HR Settings", None, "emp_created_by", "Naming Series") webnotes.conn.set_value("HR Settings", None, "emp_created_by", "Naming Series")
webnotes.conn.commit() webnotes.conn.commit()
print "Importing Employee..." import_data(["Profile", "Employee", "Salary_Structure"])
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Employee.csv")
upload()
print "Importing Salary Structure..." def import_data(dt):
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", "Salary_Structure.csv") if not isinstance(dt, (tuple, list)):
dt = [dt]
for doctype in dt:
print "Importing", doctype.replace("_", " "), "..."
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", doctype+".csv")
upload() upload()
if __name__=="__main__": if __name__=="__main__":