From a17d7cea34974f5a49a383610816dcb41d147ee8 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 7 Jan 2015 11:55:40 +0530 Subject: [PATCH 1/2] test records fixed --- .../doctype/production_order/test_production_order.py | 6 ++++++ erpnext/selling/doctype/opportunity/test_records.json | 2 ++ erpnext/stock/doctype/stock_entry/test_stock_entry.py | 2 ++ 3 files changed, 10 insertions(+) diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py index a9975c1e6f3..2ccf101c47f 100644 --- a/erpnext/manufacturing/doctype/production_order/test_production_order.py +++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py @@ -27,11 +27,15 @@ class TestProductionOrder(unittest.TestCase): s = frappe.get_doc(make_stock_entry(pro_doc.name, "Material Transfer", 4)) for d in s.get("mtn_details"): d.s_warehouse = "Stores - _TC" + s.fiscal_year = "_Test Fiscal Year 2013" + s.posting_date = "2013-01-01" s.insert() s.submit() # from wip to fg s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 4)) + s.fiscal_year = "_Test Fiscal Year 2013" + s.posting_date = "2013-01-01" s.insert() s.submit() @@ -50,6 +54,8 @@ class TestProductionOrder(unittest.TestCase): test_stock_entry.make_stock_entry("_Test Item Home Desktop 100", None, "_Test Warehouse - _TC", 100, 100) s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 7)) + s.fiscal_year = "_Test Fiscal Year 2013" + s.posting_date = "2013-01-01" s.insert() self.assertRaises(StockOverProductionError, s.submit) diff --git a/erpnext/selling/doctype/opportunity/test_records.json b/erpnext/selling/doctype/opportunity/test_records.json index 39709036358..43ab55de4fc 100644 --- a/erpnext/selling/doctype/opportunity/test_records.json +++ b/erpnext/selling/doctype/opportunity/test_records.json @@ -5,6 +5,8 @@ "enquiry_from": "Lead", "enquiry_type": "Sales", "lead": "_T-Lead-00001", + "transaction_date": "2013-12-12", + "fiscal_year": "_Test Fiscal Year 2013", "enquiry_details": [{ "item_name": "Test Item", "description": "Some description" diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index e010bd19b9d..73f1d0a92e0 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -936,6 +936,8 @@ def make_stock_entry(item, source, target, qty, incoming_rate=None): "incoming_rate": incoming_rate, "conversion_factor": 1.0 }) + s.posting_date= "2013-01-01" + s.fiscal_year= "_Test Fiscal Year 2013" s.insert() s.submit() return s From 1ff3a6cdb898cab4d5b17c19c3efdd417edada53 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 7 Jan 2015 16:24:52 +0530 Subject: [PATCH 2/2] fix --- .../doctype/production_order/test_production_order.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py index 2ccf101c47f..59e56ef348f 100644 --- a/erpnext/manufacturing/doctype/production_order/test_production_order.py +++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py @@ -10,7 +10,7 @@ from erpnext.manufacturing.doctype.production_order.production_order import make from erpnext.stock.doctype.stock_entry import test_stock_entry class TestProductionOrder(unittest.TestCase): - def test_planned_qty(self): + def check_planned_qty(self): set_perpetual_inventory(0) planned0 = frappe.db.get_value("Bin", {"item_code": "_Test FG Item", "warehouse": "_Test Warehouse 1 - _TC"}, "planned_qty") or 0 @@ -28,14 +28,14 @@ class TestProductionOrder(unittest.TestCase): for d in s.get("mtn_details"): d.s_warehouse = "Stores - _TC" s.fiscal_year = "_Test Fiscal Year 2013" - s.posting_date = "2013-01-01" + s.posting_date = "2013-01-02" s.insert() s.submit() # from wip to fg s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 4)) s.fiscal_year = "_Test Fiscal Year 2013" - s.posting_date = "2013-01-01" + s.posting_date = "2013-01-03" s.insert() s.submit() @@ -48,14 +48,14 @@ class TestProductionOrder(unittest.TestCase): def test_over_production(self): from erpnext.manufacturing.doctype.production_order.production_order import StockOverProductionError - pro_doc = self.test_planned_qty() + pro_doc = self.check_planned_qty() test_stock_entry.make_stock_entry("_Test Item", None, "_Test Warehouse - _TC", 100, 100) test_stock_entry.make_stock_entry("_Test Item Home Desktop 100", None, "_Test Warehouse - _TC", 100, 100) s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 7)) s.fiscal_year = "_Test Fiscal Year 2013" - s.posting_date = "2013-01-01" + s.posting_date = "2013-01-04" s.insert() self.assertRaises(StockOverProductionError, s.submit)