[fix] [tests]

This commit is contained in:
Rushabh Mehta 2016-04-15 15:19:35 +05:30
parent be2dde468d
commit e8e9440b06
4 changed files with 7 additions and 6 deletions

View File

@ -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]

View File

@ -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 = {

View File

@ -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)

View File

@ -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",