From 64614374d86694fe0ade61446e2af81cf8c49e88 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Mon, 7 May 2018 16:55:32 +0530 Subject: [PATCH] fix codacy --- erpnext/controllers/selling_controller.py | 12 ++--- erpnext/demo/data/item.json | 44 +++++++++---------- .../doctype/item_default/item_default.py | 1 - erpnext/stock/get_item_details.py | 2 +- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index feee067496..83e7916e84 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -352,10 +352,10 @@ def check_active_sales_items(obj): if default.company == obj.company: default.income_account = d.income_account income_account_set = True - else: - if not income_account_set: - doc.append("item_defaults", { - "company": obj.company, - "income_account": d.income_account - }) + break + if not income_account_set: + doc.append("item_defaults", { + "company": obj.company, + "income_account": d.income_account + }) doc.save() \ No newline at end of file diff --git a/erpnext/demo/data/item.json b/erpnext/demo/data/item.json index 461ed4235a..908de15d0b 100644 --- a/erpnext/demo/data/item.json +++ b/erpnext/demo/data/item.json @@ -2,7 +2,7 @@ { "default_supplier": "Asiatic Solutions", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "For Upper Bearing", "image": "/assets/erpnext_demo/images/disc.png", @@ -13,7 +13,7 @@ { "default_supplier": "Nan Duskin", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "CAST IRON, MCMASTER PART NO. 3710T13", "image": "/assets/erpnext_demo/images/bearing.jpg", @@ -24,7 +24,7 @@ { "default_supplier": null, "item_defaults": [{ - "default_warehouse": "Finished Goods", + "default_warehouse": "Finished Goods" }], "description": "Wind Mill C Series for Commercial Use 18ft", "image": "/assets/erpnext_demo/images/wind-turbine-2.png", @@ -35,7 +35,7 @@ { "default_supplier": null, "item_defaults": [{ - "default_warehouse": "Finished Goods", + "default_warehouse": "Finished Goods" }], "description": "Wind Mill A Series for Home Use 9ft", "image": "/assets/erpnext_demo/images/wind-turbine.png", @@ -46,7 +46,7 @@ { "default_supplier": null, "item_defaults": [{ - "default_warehouse": "Finished Goods", + "default_warehouse": "Finished Goods" }], "description": "Small Wind Turbine for Home Use\n\n\n", "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg", @@ -62,7 +62,7 @@ { "default_supplier": "HomeBase", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "1.5 in. Diameter x 36 in. Mild Steel Tubing", "image": null, @@ -73,7 +73,7 @@ { "default_supplier": "New World Realty", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet", "image": null, @@ -84,7 +84,7 @@ { "default_supplier": "Eagle Hardware", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate", "image": null, @@ -95,7 +95,7 @@ { "default_supplier": "Asiatic Solutions", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "Bearing Assembly", "image": null, @@ -106,7 +106,7 @@ { "default_supplier": "HomeBase", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood", "image": null, @@ -118,7 +118,7 @@ { "default_supplier": "Scott Ties", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "N/A", "image": null, @@ -129,7 +129,7 @@ { "default_supplier": "Eagle Hardware", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar", "image": null, @@ -140,7 +140,7 @@ { "default_supplier": "Eagle Hardware", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "1/4 in. x 6 in. x 6 in. Mild Steel Plate", "image": null, @@ -151,7 +151,7 @@ { "default_supplier": "HomeBase", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing", "image": null, @@ -162,7 +162,7 @@ { "default_supplier": "Eagle Hardware", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "1.25 in. Diameter x 6 ft. Mild Steel Tubing", "image": null, @@ -173,7 +173,7 @@ { "default_supplier": "Ks Merchandise", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "1/2 in. x 2 ft. x 4 ft. Pine Plywood", "image": null, @@ -184,7 +184,7 @@ { "default_supplier": "HomeBase", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "For Bearing Collar", "image": null, @@ -195,7 +195,7 @@ { "default_supplier": null, "item_defaults": [{ - "default_warehouse": "Finished Goods", + "default_warehouse": "Finished Goods" }], "description": "Small Wind Turbine for Home Use\n\n\n\n

Size: Small

", "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg", @@ -214,7 +214,7 @@ { "default_supplier": null, "item_defaults": [{ - "default_warehouse": "Finished Goods", + "default_warehouse": "Finished Goods" }], "description": "Small Wind Turbine for Home Use\n\n\n\n

Size: Medium

", "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg", @@ -233,7 +233,7 @@ { "default_supplier": null, "item_defaults": [{ - "default_warehouse": "Finished Goods", + "default_warehouse": "Finished Goods" }], "description": "Small Wind Turbine for Home Use\n\n\n\n

Size: Large

", "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg", @@ -259,7 +259,7 @@ { "default_supplier": "HomeBase", "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood", "image": null, @@ -327,7 +327,7 @@ "create_new_batch": 1, "valuation_rate": 200, "item_defaults": [{ - "default_warehouse": "Stores", + "default_warehouse": "Stores" }], "description": "Corrugated Box", "item_code": "Corrugated Box", diff --git a/erpnext/stock/doctype/item_default/item_default.py b/erpnext/stock/doctype/item_default/item_default.py index 85e84db6f1..935f0ffb0f 100644 --- a/erpnext/stock/doctype/item_default/item_default.py +++ b/erpnext/stock/doctype/item_default/item_default.py @@ -3,7 +3,6 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe from frappe.model.document import Document class ItemDefault(Document): diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index bbbe860396..fd145d2ac8 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -205,7 +205,7 @@ def get_basic_details(args, item): user_default_warehouse_list = get_user_default_as_list('Warehouse') user_default_warehouse = user_default_warehouse_list[0] \ if len(user_default_warehouse_list) == 1 else "" - + item_defaults = get_item_defaults(item.name, args.company) warehouse = user_default_warehouse or item_defaults.default_warehouse or args.warehouse