def test_planned_qty(self):
		set_perpetual_inventory(0)
		webnotes.conn.sql("delete from `tabStock Ledger Entry`")
		webnotes.conn.sql("""delete from `tabBin`""")
		webnotes.conn.sql("""delete from `tabGL Entry`""")
		
		pro_bean = webnotes.bean(copy = test_records[0])
		pro_bean.insert()
		pro_bean.submit()
		
		from stock.doctype.stock_entry.test_stock_entry import test_records as se_test_records
		mr1 = webnotes.bean(copy = se_test_records[0])
		mr1.insert()
		mr1.submit()
		
		mr2 = webnotes.bean(copy = se_test_records[0])
		mr2.doclist[1].item_code = "_Test Item Home Desktop 100"
		mr2.insert()
		mr2.submit()
		
		stock_entry = make_stock_entry(pro_bean.doc.name, "Manufacture/Repack")
		stock_entry = webnotes.bean(stock_entry)
		
		stock_entry.doc.fg_completed_qty = 4
		stock_entry.doc.posting_date = "2013-05-12"
		stock_entry.doc.fiscal_year = "_Test Fiscal Year 2013"
		stock_entry.run_method("get_items")
		stock_entry.submit()
		
		self.assertEqual(webnotes.conn.get_value("Production Order", pro_bean.doc.name, 
			"produced_qty"), 4)
		self.assertEqual(webnotes.conn.get_value("Bin", {"item_code": "_Test FG Item", 
			"warehouse": "_Test Warehouse 1 - _TC"}, "planned_qty"), 6)
			
		return pro_bean.doc.name
Example #2
0
    def test_over_production(self):
        from stock.doctype.stock_entry.stock_entry import StockOverProductionError
        pro_order = self.test_planned_qty()

        stock_entry = make_stock_entry(pro_order, "Manufacture/Repack")
        stock_entry = webnotes.bean(stock_entry)

        stock_entry.doc.fg_completed_qty = 15
        stock_entry.run_method("get_items")
        stock_entry.insert()

        self.assertRaises(StockOverProductionError, stock_entry.submit)
Example #3
0
	def test_over_production(self):
		from stock.doctype.stock_entry.stock_entry import StockOverProductionError
		pro_order = self.test_planned_qty()
		
		stock_entry = make_stock_entry(pro_order, "Manufacture/Repack")
		stock_entry = webnotes.bean(stock_entry)
		
		stock_entry.doc.fg_completed_qty = 15
		stock_entry.run_method("get_items")
		stock_entry.insert()
		
		self.assertRaises(StockOverProductionError, stock_entry.submit)
Example #4
0
	def test_over_production(self):
		from manufacturing.doctype.production_order.production_order import StockOverProductionError
		pro_order = self.test_planned_qty()

		stock_entry = make_stock_entry(pro_order, "Manufacture/Repack")
		stock_entry = webnotes.bean(stock_entry)
		stock_entry.doc.posting_date = "2013-05-12"
		stock_entry.doc.fiscal_year = "_Test Fiscal Year 2013"
		stock_entry.doc.fg_completed_qty = 15
		stock_entry.run_method("get_items")
		stock_entry.insert()

		self.assertRaises(StockOverProductionError, stock_entry.submit)
Example #5
0
    def test_over_production(self):
        from manufacturing.doctype.production_order.production_order import StockOverProductionError
        pro_order = self.test_planned_qty()

        stock_entry = make_stock_entry(pro_order, "Manufacture/Repack")
        stock_entry = webnotes.bean(stock_entry)
        stock_entry.doc.posting_date = "2013-05-12"
        stock_entry.doc.fiscal_year = "_Test Fiscal Year 2013"
        stock_entry.doc.fg_completed_qty = 15
        stock_entry.run_method("get_items")
        stock_entry.insert()

        self.assertRaises(StockOverProductionError, stock_entry.submit)
Example #6
0
def make_stock_entry_from_pro(pro_id, purpose, current_date):
	from manufacturing.doctype.production_order.production_order import make_stock_entry
	from stock.stock_ledger import NegativeStockError
	from stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, DuplicateEntryForProductionOrderError

	try:
		st = webnotes.bean(make_stock_entry(pro_id, purpose))
		st.doc.posting_date = current_date
		st.doc.fiscal_year = "2013"
		st.doc.expense_adjustment_account = "Stock in Hand - WP"
		st.insert()
		webnotes.conn.commit()
		st.submit()
		webnotes.conn.commit()
	except NegativeStockError: pass
	except IncorrectValuationRateError: pass
	except DuplicateEntryForProductionOrderError: pass
Example #7
0
def make_stock_entry_from_pro(pro_id, purpose, current_date):
	from manufacturing.doctype.production_order.production_order import make_stock_entry
	from stock.stock_ledger import NegativeStockError
	from stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, DuplicateEntryForProductionOrderError

	try:
		st = webnotes.bean(make_stock_entry(pro_id, purpose))
		st.doc.posting_date = current_date
		st.doc.fiscal_year = "2013"
		st.doc.expense_adjustment_account = "Stock in Hand - WP"
		st.insert()
		webnotes.conn.commit()
		st.submit()
		webnotes.conn.commit()
	except NegativeStockError: pass
	except IncorrectValuationRateError: pass
	except DuplicateEntryForProductionOrderError: pass
Example #8
0
def make_stock_entry_from_pro(pro_id, purpose, current_date):
	from manufacturing.doctype.production_order.production_order import make_stock_entry
	from stock.stock_ledger import NegativeStockError
	from stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, DuplicateEntryForProductionOrderError

	try:
		st = webnotes.bean(make_stock_entry(pro_id, purpose))
		st.doc.posting_date = current_date
		st.doc.fiscal_year = "2013"
		for d in st.doclist.get({"parentfield": "mtn_details"}):
			d.expense_account = "Stock Adjustment - " + company_abbr
			d.cost_center = "Main - " + company_abbr
		st.insert()
		webnotes.conn.commit()
		st.submit()
		webnotes.conn.commit()
	except NegativeStockError: pass
	except IncorrectValuationRateError: pass
	except DuplicateEntryForProductionOrderError: pass
Example #9
0
    def test_planned_qty(self):
        set_perpetual_inventory(0)
        webnotes.conn.sql("delete from `tabStock Ledger Entry`")
        webnotes.conn.sql("""delete from `tabBin`""")
        webnotes.conn.sql("""delete from `tabGL Entry`""")

        pro_bean = webnotes.bean(copy=test_records[0])
        pro_bean.insert()
        pro_bean.submit()

        from stock.doctype.stock_entry.test_stock_entry import test_records as se_test_records
        mr1 = webnotes.bean(copy=se_test_records[0])
        mr1.insert()
        mr1.submit()

        mr2 = webnotes.bean(copy=se_test_records[0])
        mr2.doclist[1].item_code = "_Test Item Home Desktop 100"
        mr2.insert()
        mr2.submit()

        stock_entry = make_stock_entry(pro_bean.doc.name, "Manufacture/Repack")
        stock_entry = webnotes.bean(stock_entry)

        stock_entry.doc.fg_completed_qty = 4
        stock_entry.doc.posting_date = "2013-05-12"
        stock_entry.doc.fiscal_year = "_Test Fiscal Year 2013"
        stock_entry.run_method("get_items")
        stock_entry.submit()

        self.assertEqual(
            webnotes.conn.get_value("Production Order", pro_bean.doc.name,
                                    "produced_qty"), 4)
        self.assertEqual(
            webnotes.conn.get_value(
                "Bin", {
                    "item_code": "_Test FG Item",
                    "warehouse": "_Test Warehouse 1 - _TC"
                }, "planned_qty"), 6)

        return pro_bean.doc.name
Example #10
0
def make_stock_entry_from_pro(pro_id, purpose, current_date):
    from manufacturing.doctype.production_order.production_order import make_stock_entry
    from stock.stock_ledger import NegativeStockError
    from stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, DuplicateEntryForProductionOrderError

    try:
        st = webnotes.bean(make_stock_entry(pro_id, purpose))
        st.doc.posting_date = current_date
        st.doc.fiscal_year = current_date.year
        for d in st.doclist.get({"parentfield": "mtn_details"}):
            d.expense_account = "Stock Adjustment - " + company_abbr
            d.cost_center = "Main - " + company_abbr
        st.insert()
        webnotes.conn.commit()
        st.submit()
        webnotes.conn.commit()
    except NegativeStockError:
        pass
    except IncorrectValuationRateError:
        pass
    except DuplicateEntryForProductionOrderError:
        pass