From e8e9440b06d1e46b4fc07fba6f8a5e6b486cedb2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 15 Apr 2016 15:19:35 +0530 Subject: [PATCH] [fix] [tests] --- erpnext/manufacturing/doctype/bom/bom.py | 4 ++-- .../doctype/production_order/production_order.py | 1 - .../doctype/production_order/test_production_order.py | 3 ++- erpnext/stock/doctype/material_request/material_request.json | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 8779c49ffaa..e2774193333 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -15,13 +15,13 @@ form_grid_templates = { class BOM(Document): def autoname(self): - names = frappe.db.sql("""select name from `tabBOM` where item=%s""", self.item) + names = frappe.db.sql_list("""select name from `tabBOM` where item=%s""", self.item) if names: # name can be BOM/ITEM/001, BOM/ITEM/001-1, BOM-ITEM-001, BOM-ITEM-001-1 # split by item - names = [name[0].split(self.item)[-1][1:] for name in names] + names = [name.split(self.item)[-1][1:] for name in names] # split by (-) if cancelled names = [cint(name.split('-')[-1]) for name in names] diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index 25139474624..88ee997d469 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -19,7 +19,6 @@ from erpnext.stock.stock_balance import get_planned_qty, update_bin_qty class OverProductionError(frappe.ValidationError): pass class StockOverProductionError(frappe.ValidationError): pass class OperationTooLongError(frappe.ValidationError): pass -class ProductionNotApplicableError(frappe.ValidationError): pass class ItemHasVariantError(frappe.ValidationError): pass form_grid_templates = { diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py index 980f1521812..3b558a9f429 100644 --- a/erpnext/manufacturing/doctype/production_order/test_production_order.py +++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py @@ -8,7 +8,7 @@ import frappe from frappe.utils import flt, time_diff_in_hours, now, add_days from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory from erpnext.manufacturing.doctype.production_order.production_order \ - import make_stock_entry, ProductionNotApplicableError,ItemHasVariantError + import make_stock_entry, ItemHasVariantError from erpnext.stock.doctype.stock_entry import test_stock_entry from erpnext.projects.doctype.time_log.time_log import OverProductionLoggedError @@ -125,6 +125,7 @@ class TestProductionOrder(unittest.TestCase): self.assertEqual(prod_order.planned_operating_cost, cost*2) def test_production_item(self): + prod_order = make_prod_order_test_record(item="_Test FG Item", qty=1, do_not_save=True) frappe.db.set_value("Item", "_Test FG Item", "end_of_life", "2000-1-1") self.assertRaises(frappe.ValidationError, prod_order.save) diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json index 6b4217eec33..19467d96b47 100644 --- a/erpnext/stock/doctype/material_request/material_request.json +++ b/erpnext/stock/doctype/material_request/material_request.json @@ -283,7 +283,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_list_view": 1, + "in_list_view": 0, "label": "Requested For", "length": 0, "no_copy": 0, @@ -576,7 +576,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-04-06 05:38:23.398251", + "modified": "2016-04-15 05:41:26.657236", "modified_by": "Administrator", "module": "Stock", "name": "Material Request", @@ -663,6 +663,7 @@ "write": 1 } ], + "quick_entry": 1, "read_only": 0, "read_only_onload": 1, "search_fields": "status,transaction_date",