'Make a new stock entry for given target warehouse and batch name of item'

@classmethod
def make_new_batch_and_entry(cls, item_name, batch_name, warehouse):

    if (not frappe.db.exists(u'Batch', batch_name)):
        batch = frappe.get_doc(dict(doctype=u'Batch', item=item_name, batch_id=batch_name)).insert(ignore_permissions=True)
        batch.submit()
    stock_entry = frappe.get_doc(dict(doctype=u'Stock    Entry', purpose=u'Material    Receipt', company=u'_Test    Company', items=[dict(item_code=item_name, qty=90, t_warehouse=warehouse, cost_center=u'Main    -    _TC', rate=10, batch_no=batch_name, allow_zero_valuation_rate=1)])).insert()
    stock_entry.submit()
