item data fix for default supplier, exception handling for purchase order

This commit is contained in:
Zlash65 2018-10-01 12:55:07 +05:30
parent d080a17961
commit 8b1133cb24
2 changed files with 77 additions and 73 deletions

View File

@ -1,7 +1,7 @@
[ [
{ {
"default_supplier": "Asiatic Solutions",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "Asiatic Solutions",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "For Upper Bearing", "description": "For Upper Bearing",
@ -11,8 +11,8 @@
"item_name": "Disc Collars" "item_name": "Disc Collars"
}, },
{ {
"default_supplier": "Nan Duskin",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "Nan Duskin",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "CAST IRON, MCMASTER PART NO. 3710T13", "description": "CAST IRON, MCMASTER PART NO. 3710T13",
@ -22,8 +22,8 @@
"item_name": "Bearing Block" "item_name": "Bearing Block"
}, },
{ {
"default_supplier": null,
"item_defaults": [{ "item_defaults": [{
"default_supplier": null,
"default_warehouse": "Finished Goods" "default_warehouse": "Finished Goods"
}], }],
"description": "Wind Mill C Series for Commercial Use 18ft", "description": "Wind Mill C Series for Commercial Use 18ft",
@ -33,8 +33,8 @@
"item_name": "Wind MIll C Series" "item_name": "Wind MIll C Series"
}, },
{ {
"default_supplier": null,
"item_defaults": [{ "item_defaults": [{
"default_supplier": null,
"default_warehouse": "Finished Goods" "default_warehouse": "Finished Goods"
}], }],
"description": "Wind Mill A Series for Home Use 9ft", "description": "Wind Mill A Series for Home Use 9ft",
@ -44,8 +44,8 @@
"item_name": "Wind Mill A Series" "item_name": "Wind Mill A Series"
}, },
{ {
"default_supplier": null,
"item_defaults": [{ "item_defaults": [{
"default_supplier": null,
"default_warehouse": "Finished Goods" "default_warehouse": "Finished Goods"
}], }],
"description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->", "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->",
@ -60,8 +60,8 @@
] ]
}, },
{ {
"default_supplier": "HomeBase",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "HomeBase",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "1.5 in. Diameter x 36 in. Mild Steel Tubing", "description": "1.5 in. Diameter x 36 in. Mild Steel Tubing",
@ -71,8 +71,8 @@
"item_name": "Bearing Pipe" "item_name": "Bearing Pipe"
}, },
{ {
"default_supplier": "New World Realty",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "New World Realty",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet", "description": "1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet",
@ -82,8 +82,8 @@
"item_name": "Wing Sheet" "item_name": "Wing Sheet"
}, },
{ {
"default_supplier": "Eagle Hardware",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "Eagle Hardware",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate", "description": "3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate",
@ -93,8 +93,8 @@
"item_name": "Upper Bearing Plate" "item_name": "Upper Bearing Plate"
}, },
{ {
"default_supplier": "Asiatic Solutions",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "Asiatic Solutions",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "Bearing Assembly", "description": "Bearing Assembly",
@ -104,8 +104,8 @@
"item_name": "Bearing Assembly" "item_name": "Bearing Assembly"
}, },
{ {
"default_supplier": "HomeBase",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "HomeBase",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood", "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood",
@ -116,8 +116,8 @@
"is_sub_contracted_item": 1 "is_sub_contracted_item": 1
}, },
{ {
"default_supplier": "Scott Ties",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "Scott Ties",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "N/A", "description": "N/A",
@ -127,8 +127,8 @@
"item_name": "Stand" "item_name": "Stand"
}, },
{ {
"default_supplier": "Eagle Hardware",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "Eagle Hardware",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar", "description": "1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar",
@ -138,8 +138,8 @@
"item_name": "Bearing Collar" "item_name": "Bearing Collar"
}, },
{ {
"default_supplier": "Eagle Hardware",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "Eagle Hardware",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "1/4 in. x 6 in. x 6 in. Mild Steel Plate", "description": "1/4 in. x 6 in. x 6 in. Mild Steel Plate",
@ -149,8 +149,8 @@
"item_name": "Base Bearing Plate" "item_name": "Base Bearing Plate"
}, },
{ {
"default_supplier": "HomeBase",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "HomeBase",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing", "description": "15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing",
@ -160,8 +160,8 @@
"item_name": "External Disc" "item_name": "External Disc"
}, },
{ {
"default_supplier": "Eagle Hardware",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "Eagle Hardware",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "1.25 in. Diameter x 6 ft. Mild Steel Tubing", "description": "1.25 in. Diameter x 6 ft. Mild Steel Tubing",
@ -171,8 +171,8 @@
"item_name": "Shaft" "item_name": "Shaft"
}, },
{ {
"default_supplier": "Ks Merchandise",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "Ks Merchandise",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "1/2 in. x 2 ft. x 4 ft. Pine Plywood", "description": "1/2 in. x 2 ft. x 4 ft. Pine Plywood",
@ -182,8 +182,8 @@
"item_name": "Blade Rib" "item_name": "Blade Rib"
}, },
{ {
"default_supplier": "HomeBase",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "HomeBase",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "For Bearing Collar", "description": "For Bearing Collar",
@ -193,8 +193,8 @@
"item_name": "Internal Disc" "item_name": "Internal Disc"
}, },
{ {
"default_supplier": null,
"item_defaults": [{ "item_defaults": [{
"default_supplier": null,
"default_warehouse": "Finished Goods" "default_warehouse": "Finished Goods"
}], }],
"description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Small</p>", "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Small</p>",
@ -212,8 +212,8 @@
] ]
}, },
{ {
"default_supplier": null,
"item_defaults": [{ "item_defaults": [{
"default_supplier": null,
"default_warehouse": "Finished Goods" "default_warehouse": "Finished Goods"
}], }],
"description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Medium</p>", "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Medium</p>",
@ -231,8 +231,8 @@
] ]
}, },
{ {
"default_supplier": null,
"item_defaults": [{ "item_defaults": [{
"default_supplier": null,
"default_warehouse": "Finished Goods" "default_warehouse": "Finished Goods"
}], }],
"description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Large</p>", "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Large</p>",
@ -257,8 +257,8 @@
"item_name": "Wind Mill A Series with Spare Bearing" "item_name": "Wind Mill A Series with Spare Bearing"
}, },
{ {
"default_supplier": "HomeBase",
"item_defaults": [{ "item_defaults": [{
"default_supplier": "HomeBase",
"default_warehouse": "Stores" "default_warehouse": "Stores"
}], }],
"description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood", "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood",

View File

@ -80,6 +80,7 @@ def work():
report = "Requested Items To Be Ordered" report = "Requested Items To Be Ordered"
for row in query_report.run(report)["result"][:how_many("Purchase Order")]: for row in query_report.run(report)["result"][:how_many("Purchase Order")]:
if row[0] != "'Total'": if row[0] != "'Total'":
try:
po = frappe.get_doc(make_purchase_order(row[0])) po = frappe.get_doc(make_purchase_order(row[0]))
po.supplier = supplier po.supplier = supplier
po.currency = party_account_currency or company_currency po.currency = party_account_currency or company_currency
@ -87,6 +88,9 @@ def work():
po.transaction_date = frappe.flags.current_date po.transaction_date = frappe.flags.current_date
po.insert() po.insert()
po.submit() po.submit()
except Exception:
pass
else:
frappe.db.commit() frappe.db.commit()
if random.random() < 0.5: if random.random() < 0.5: