[cleanup] [minor] price list field rename (wip), set default supplier from item, make demo - purchase cycle (wip)

This commit is contained in:
Rushabh Mehta 2013-08-09 15:29:59 +05:30
parent be64070ed9
commit 0b9954059c
25 changed files with 158 additions and 72 deletions

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 12:15:51",
"docstatus": 0,
"modified": "2013-08-08 14:21:57",
"modified": "2013-08-09 14:45:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -92,7 +92,7 @@
},
{
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "selling_price_list",
"fieldtype": "Link",
"label": "Price List",
"oldfieldname": "price_list_name",

View File

@ -7,7 +7,7 @@ test_records = [
"name": "_Test POS Setting",
"currency": "INR",
"conversion_rate": 1.0,
"price_list_name": "_Test Price List",
"selling_price_list": "_Test Price List",
"company": "_Test Company",
"warehouse": "_Test Warehouse - _TC",
"territory": "_Test Territory",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-08-08 14:21:58",
"modified": "2013-08-09 14:45:35",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -242,7 +242,7 @@
{
"description": "Consider this Price List for fetching rate. (only which have \"For Buying\" as checked)",
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List",

View File

@ -210,7 +210,7 @@ class DocType(SellingController):
}, "master_name")
for fieldname in ('territory', 'naming_series', 'currency', 'charge', 'letter_head', 'tc_name',
'price_list_name', 'company', 'select_print_heading', 'cash_bank_account'):
'selling_price_list', 'company', 'select_print_heading', 'cash_bank_account'):
if (not for_validate) or (for_validate and not self.doc.fields.get(fieldname)):
self.doc.fields[fieldname] = pos.get(fieldname)

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:05",
"docstatus": 0,
"modified": "2013-08-08 14:22:01",
"modified": "2013-08-09 14:45:42",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -246,7 +246,7 @@
},
{
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "selling_price_list",
"fieldtype": "Link",
"label": "Price List",
"oldfieldname": "price_list_name",

View File

@ -666,7 +666,7 @@ test_records = [
"plc_conversion_rate": 1.0,
"posting_date": "2013-01-23",
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"selling_price_list": "_Test Price List",
"territory": "_Test Territory"
},
{
@ -729,7 +729,7 @@ test_records = [
"plc_conversion_rate": 1.0,
"posting_date": "2013-03-07",
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"selling_price_list": "_Test Price List",
"territory": "_Test Territory"
},
{
@ -780,7 +780,7 @@ test_records = [
"plc_conversion_rate": 1.0,
"posting_date": "2013-01-23",
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"selling_price_list": "_Test Price List",
"territory": "_Test Territory",
},
# items
@ -905,7 +905,7 @@ test_records = [
"plc_conversion_rate": 1.0,
"posting_date": "2013-01-23",
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"selling_price_list": "_Test Price List",
"territory": "_Test Territory",
},
# items

View File

@ -11,6 +11,6 @@ class DocType:
self.doc, self.doclist = d, dl
def validate(self):
for key in ["supplier_type", "supp_master_name", "maintain_same_rate"]:
for key in ["supplier_type", "supp_master_name", "maintain_same_rate", "buying_price_list"]:
webnotes.conn.set_default(key, self.doc.fields.get(key, ""))

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-25 11:04:03",
"docstatus": 0,
"modified": "2013-07-05 14:29:41",
"modified": "2013-08-09 14:38:46",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -53,6 +53,13 @@
"label": "Default Supplier Type",
"options": "Supplier Type"
},
{
"doctype": "DocField",
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Default Buying Price List",
"options": "Price List"
},
{
"doctype": "DocField",
"fieldname": "column_break_3",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-08-08 14:22:03",
"modified": "2013-08-09 14:45:51",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -211,7 +211,7 @@
{
"description": "Consider this Price List for fetching rate. (only which have \"For Buying\" as checked)",
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:45",
"docstatus": 0,
"modified": "2013-08-08 14:22:08",
"modified": "2013-08-09 14:45:58",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -208,7 +208,7 @@
{
"description": "Consider this Price List for fetching rate. (only which have \"For Buying\" as checked)",
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List",

View File

@ -111,9 +111,14 @@ wn.module_page["Buying"] = [
icon: "icon-list",
items: [
{
"label":wn._("Item-wise Purchase History"),
route: "query-report/Item-wise Purchase History",
doctype: "Item"
"label":wn._("Requested Items To Be Ordered"),
route: "query-report/Requested Items To Be Ordered",
doctype: "Material Request"
},
{
"label":wn._("Material Requests for which Supplier Quotations are not created"),
route: "query-report/Material Requests for which Supplier Quotations are not created",
doctype: "Material Request"
},
{
"label":wn._("Purchase In Transit"),
@ -121,20 +126,20 @@ wn.module_page["Buying"] = [
doctype: "Purchase Order"
},
{
"label":wn._("Requested Items To Be Ordered"),
route: "query-report/Requested Items To Be Ordered",
doctype: "Material Request"
"label":wn._("Item-wise Purchase History"),
route: "query-report/Item-wise Purchase History",
doctype: "Item"
},
{
"label":wn._("Item-wise Last Purchase Rate"),
route: "query-report/Item-wise Last Purchase Rate",
doctype: "Item"
},
{
"label":wn._("Purchase Order Trends"),
route: "query-report/Purchase Order Trends",
doctype: "Purchase Order"
},
{
"label":wn._("Item-wise Last Purchase Rate"),
route: "query-report/Item-wise Last Purchase Rate",
doctype: "Item"
}
]
}
]

View File

@ -30,6 +30,7 @@ class BuyingController(StockController):
def set_missing_values(self, for_validate=False):
super(BuyingController, self).set_missing_values(for_validate)
self.set_supplier_from_item_default()
self.set_price_list_currency("Buying")
# set contact and address details for supplier, if they are not mentioned
@ -40,6 +41,14 @@ class BuyingController(StockController):
self.set_missing_item_details(get_item_details)
def set_supplier_from_item_default(self):
if self.meta.get_field("supplier") and not self.doc.supplier:
for d in self.doclist.get({"doctype": self.tname}):
supplier = webnotes.conn.get_value("Item", d.item_code, "default_supplier")
if supplier:
self.doc.supplier = supplier
break
def get_purchase_tax_details(self):
self.doclist = self.doc.clear_table(self.doclist, "purchase_tax_details")
self.set_taxes("purchase_tax_details", "purchase_other_charges")

View File

@ -2,7 +2,7 @@
{
"creation": "2013-01-22 15:11:38",
"docstatus": 0,
"modified": "2013-08-07 17:09:46",
"modified": "2013-08-09 14:47:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -115,7 +115,7 @@
"depends_on": "eval:doc.rm_cost_as_per===\"Price List\"",
"description": "Price List for Costing",
"doctype": "DocField",
"fieldname": "price_list",
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List"

View File

@ -0,0 +1,23 @@
import webnotes
def execute():
for t in [
("Supplier Quotation", "price_list_name", "buying_price_list"),
("Purchase Order", "price_list_name", "buying_price_list"),
("Purchase Invoice", "price_list_name", "buying_price_list"),
("Purchase Receipt", "price_list_name", "buying_price_list"),
("Quotation", "price_list_name", "selling_price_list"),
("Sales Order", "price_list_name", "selling_price_list"),
("Delivery Note", "price_list_name", "selling_price_list"),
("Sales Invoice", "price_list_name", "selling_price_list"),
("POS Setting", "price_list_name", "selling_price_list"),
("Shopping Cart Price List", "price_list", "selling_price_list"),
("Item Price", "price_list_name", "price_list"),
("BOM", "price_list", "buying_price_list"),
]:
webnotes.conn.sql_ddl("alter table `tab%s` change `%s` `%s` varchar(180)" % t)
webnotes.conn.sql("""update tabSingles set field='selling_price_list'
where field='price_list_name' and doctype='Selling Settings'""")
webnotes.bean("Selling Settings").save()

View File

@ -252,4 +252,5 @@ patch_list = [
"patches.july_2013.p11_update_price_list_currency",
"execute:webnotes.bean('Selling Settings').save() #2013-07-29",
"patches.august_2013.p01_hr_settings",
"patches.august_2013.p02_rename_price_list",
]

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:08",
"docstatus": 0,
"modified": "2013-08-08 14:22:16",
"modified": "2013-08-09 14:46:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -280,7 +280,7 @@
{
"description": "Select the price list as entered in \"Price List\" master. This will pull the reference rates of items against this price list as specified in \"Item\" master.",
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "selling_price_list",
"fieldtype": "Link",
"in_filter": 1,
"label": "Price List",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-18 12:39:59",
"docstatus": 0,
"modified": "2013-08-08 14:22:17",
"modified": "2013-08-09 14:46:17",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -293,7 +293,7 @@
{
"description": "Select the price list as entered in \"Price List\" master. This will pull the reference rates of items against this price list as specified in \"Item\" master.",
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "selling_price_list",
"fieldtype": "Link",
"label": "Price List",
"oldfieldname": "price_list_name",

View File

@ -12,5 +12,5 @@ class DocType:
def validate(self):
for key in ["cust_master_name", "customer_group", "territory", "maintain_same_sales_rate",
"editable_price_list_rate"]:
"editable_price_list_rate", "selling_price_list"]:
webnotes.conn.set_default(key, self.doc.fields.get(key, ""))

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-25 10:25:16",
"docstatus": 0,
"modified": "2013-08-02 12:09:20",
"modified": "2013-08-09 14:46:24",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -64,7 +64,7 @@
},
{
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "selling_price_list",
"fieldtype": "Link",
"label": "Default Price List",
"options": "Price List"

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:09",
"docstatus": 0,
"modified": "2013-08-08 14:22:21",
"modified": "2013-08-09 14:46:32",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -285,7 +285,7 @@
{
"description": "Select the price list as entered in \"Price List\" master. This will pull the reference rates of items against this price list as specified in \"Item\" master.",
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "selling_price_list",
"fieldtype": "Link",
"label": "Price List",
"oldfieldname": "price_list_name",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-02 16:29:48",
"docstatus": 0,
"modified": "2013-07-31 17:30:34",
"modified": "2013-08-09 14:46:58",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -30,7 +30,7 @@
},
{
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "price_list",
"fieldtype": "Link",
"in_filter": 1,
"label": "Price List Name",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-08-08 14:22:28",
"modified": "2013-08-09 14:47:05",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -237,7 +237,7 @@
{
"description": "Consider this Price List for fetching rate. (only which have \"For Buying\" as checked)",
"doctype": "DocField",
"fieldname": "price_list_name",
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List",

View File

@ -12,27 +12,27 @@
"You can only upload upto 5000 records in one go. (may be less in some cases)"
""
"DocType:","Item","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"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"
"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","Document Numbering 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"
"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"
"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"
"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"
"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",""
"Start entering data below this line"
"","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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,"","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","Stand","Stand","Raw Material","Nos","N/A","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Stand","","","","","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","Eagle Hardware","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","HomeBase","","","","","","","","","","","","","","","","","",""
"","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,"","","","","","","Asiatic Solutions","","","","","","","","","","","BOM/Bearing Assembly/001","","","","","","",""
"","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","","","","","","","","","","Nan Duskin","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","Eagle Hardware","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","HomeBase","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","Ks Merchandise","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","Asiatic Solutions","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","HomeBase","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","HomeBase","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","Eagle Hardware","","","","","","","","","","","","","","","","","",""
"","Stand","Stand","Raw Material","Nos","N/A","Yes","No","No","No","Yes","Yes","Yes","No","No","No","No","No","","Stand","","","","","Stores - WP","","","","","","","","","","Scott Ties","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","Eagle Hardware","","","","","","","","","","","","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","BOM/Wind Mill A Series/001","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","BOM/Wind MIll C Series/001","","","","","","",""
"","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","","","","","","","","","","","","","","","","","","","","","BOM/Wind Turbine/001","","","","","","",""
"","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","","","","","","","","","","New World Realty","","","","","","","","","","","","","","","","","",""

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

View File

@ -3,17 +3,22 @@
import webnotes, os, datetime
import webnotes.utils
from webnotes.widgets import query_report
import random
webnotes.session = webnotes._dict({"user":"Administrator"})
from core.page.data_import_tool.data_import_tool import upload
# fix price list
# fix fiscal year
company = "Wind Power LLC"
start_date = '2010-01-01'
runs_for = 100
prob = {
"Quotation": { "make": 0.5, "qty": (1,3) },
"Sales Order": { "make": 0.5, "qty": (1,2) }
"Sales Order": { "make": 0.5, "qty": (1,2) },
"Supplier Quotation": { "make": 0.5, "qty": (1, 3) }
}
def make():
@ -48,21 +53,51 @@ def simulate():
run_sales(current_date)
run_purchase(current_date)
run_manufacturing(current_date)
run_stock(current_date)
webnotes.conn.commit()
def run_sales(current_date):
if random.random() < prob["Quotation"]["make"]:
for i in xrange(random.randrange(*prob["Quotation"]["qty"])):
if can_make("Quotation"):
for i in xrange(how_many("Quotation")):
make_quotation(current_date)
if random.random() < prob["Sales Order"]["make"]:
for i in xrange(random.randrange(*prob["Sales Order"]["qty"])):
if can_make("Sales Order"):
for i in xrange(how_many("Sales Order")):
make_sales_order(current_date)
def run_purchase(current_date):
pass
def run_stock(current_date):
# make purchase requests
# make delivery notes (if possible)
# make stock entry (from production order)
def run_purchase(current_date):
# make supplier quotations
if can_make("Supplier Quotation"):
from stock.doctype.material_request.material_request import make_supplier_quotation
report = "Material Requests for which Supplier Quotations are not created"
for row in query_report.run(report)["result"][:how_many("Supplier Quotation")]:
sq = webnotes.bean(make_supplier_quotation(row[0]))
sq.doc.transaction_date = current_date
sq.doc.fiscal_year = "2010"
po.doc.price_list = "Standard Buying"
sq.insert()
sq.submit()
# make purchase orders
if can_make("Purchase Order"):
from stock.doctype.material_request.material_request import make_purchase_order
report = "Requested Items To Be Ordered"
for row in query_report.run(report)["result"][:how_many("Purchase Order")]:
po = webnotes.bean(make_purchase_order(row[0]))
po.doc.transaction_date = current_date
po.doc.fiscal_year = "2010"
po.doc.price_list = "Standard Buying"
po.insert()
po.submit()
def run_manufacturing(current_date):
ppt = webnotes.bean("Production Planning Tool", "Production Planning Tool")
ppt.doc.company = company
@ -146,6 +181,12 @@ def get_random(doctype, filters=None):
return out
def can_make(doctype):
return random.random() < prob.get(doctype, {"make": 0.5})["make"]
def how_many(doctype):
return random.randrange(*prob.get(doctype, {"qty": (1, 3)})["qty"])
def install():
print "Creating Fresh Database..."
from webnotes.install_lib.install import Installer

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-20 16:00:18",
"docstatus": 0,
"modified": "2013-07-10 14:54:23",
"modified": "2013-08-09 14:47:12",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -14,7 +14,7 @@
},
{
"doctype": "DocField",
"fieldname": "price_list",
"fieldname": "selling_price_list",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Price List",