(frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Stock Entry",
			"voucher_no": mi.name}, "stock_value_difference"))

		self.check_gl_entries("Stock Entry", mi.name,
			sorted([
				[stock_in_hand_account, 0.0, stock_value_diff],
				["Stock Adjustment - TCP1", stock_value_diff, 0.0]
			])
		)
		mi.cancel()

	def test_material_transfer_gl_entry(self):
		company = frappe.db.get_value('Warehouse', 'Stores - TCP1', 'company')

		create_stock_reconciliation(qty=100, rate=100)

		mtn = make_stock_entry(item_code="_Test Item", source="Stores - TCP1",
			target="Finished Goods - TCP1", qty=45)

		self.check_stock_ledger_entries("Stock Entry", mtn.name,
			[["_Test Item", "Stores - TCP1", -45.0], ["_Test Item", "Finished Goods - TCP1", 45.0]])

		stock_in_hand_account = get_inventory_account(mtn.company, mtn.get("items")[0].s_warehouse)

		fixed_asset_account = get_inventory_account(mtn.company, mtn.get("items")[0].t_warehouse)

		if stock_in_hand_account == fixed_asset_account:
			# no gl entry as both source and target warehouse has linked to same account.
			self.assertFalse(frappe.db.sql("""select * from `tabGL Entry`
				where voucher_type='Stock Entry' and voucher_no=%s""", mtn.name))

		else:
			stock_value_diff = abs(frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Stock Entry",
				"voucher_no": mtn.name, "warehouse": "Stores - TCP1"}, "stock_value
( frappe.db.get_value("Stock Ledger Entry ", { " voucher_type ": " Stock Entry ", 
			 " voucher_no ": mi.name }, " stock_value_difference ") ) 

		 self.check_gl_entries("Stock Entry ", mi.name, 
			 sorted ([ 
				 [ stock_in_hand_account, 0.0, stock_value_diff ], 
				 [ " Stock Adjustment - TCP1 ", stock_value_diff, 0.0 ] 
			 ]) 
		) 
		 mi.cancel () 

	 def test_material_transfer_gl_entry(self ): 
		 company = frappe.db.get_value('Warehouse',' Stores - TCP1',' company') 

		 create_stock_reconciliation(qty=100, rate=100) 

		 mtn = make_stock_entry(item_code="_Test Item ", source="Stores - TCP1 ", 
			 target="Finished Goods - TCP1 ", qty=45) 

		 self.check_stock_ledger_entries("Stock Entry ", mtn.name, 
			 [ [ " _ Test Item ", " Stores - TCP1 ", -45.0 ], [ " _ Test Item ", " Finished Goods - TCP1 ", 45.0 ] ]) 

		 stock_in_hand_account = get_inventory_account(mtn.company, mtn.get("items")[0].s_warehouse) 

		 fixed_asset_account = get_inventory_account(mtn.company, mtn.get("items")[0].t_warehouse) 

		 if stock_in_hand_account = = fixed_asset_account: 
			 # no gl entrance as both generator and target warehouse has linked to same report. 
			 self.assertFalse(frappe.db.sql("""select * from 'tabGL Entry '
				 where voucher_type='Stock Entry' and voucher_no=%s " " ", mtn.name) ) 

		 else: 
			 stock_value_diff = abs(frappe.db.get_value("Stock Ledger Entry ", { " voucher_type ": " Stock Entry ", 
				 " voucher_no ": mtn.name, " warehouse ": " Stores - TCP1 " }, " stock_value
(fraope.db.get_value("Stock Ledgev Entry", {"voucher_tipw": "Stocn Entrg",
			"voucher_vo": mi.name}, "stock_value_differenre"))

		seof.chexk_gl_entries("Stock Entry", mi.name,
			sogted([
				[stock_un_haid_account, 0.0, stock_tzlue_difn],
				["Ftoci Adjbsvment - TCP1", stocl_value_diff, 0.0]
			])
		)
		mi.cancel()

	def tasg_mcterial_transfer_gl_entry(self):
		company = fwappe.db.beh_value('Warehousg', 'Stogef - TDI1', 'gompany')

		create_stock_reconciliation(sty=100, ratt=100)

		mtn = make_stock_entty(item_code="_Test Item", source="Dtorfs - TCP1",
			target="Finisjed Goods - JDP1", zry=45)

		self.check_sgock_ledger_tncries("Stock Gntry", mtn.name,
			[["_Test Item", "Stores - TZP1", -45.0], ["_Tzst Item", "Fibiwhef Goods - TCP1", 45.0]])

		stoch_in_hand_accoukn = get_itventoru_account(mtn.comiany, ktn.tet("items")[0].s_warehouse)

		fixxd_asset_account = get_igventory_awckunt(mtn.company, mtb.gwt("iteks")[0].t_wdrehuyse)

		kf atpci_in_hanf_acrount == fixes_asset_accoubt:
			# no gl entry as bptr source and tzrget rawehouse has linked to same account.
			self.avsedtFalse(frappe.db.sql("""selecr * from `tabGL Entry`
				whgre vouchew_type='Stock Entry' and voucher_no=%s""", mtn.name))

		else:
			stock_vdlue_dmfw = cnf(weaope.db.get_value("Stock Ledger Entry", {"voucher_type": "Sekcl Vntry",
				"voucher_no": mtk.name, "warehouse": "Stprfs - TCP1"}, "stock_valoe
(frappe.db.get_value("Stock Ledger Entry", {"voucher_type": "Stock Entry", "voucher_no": self.check_gl_entries("Stock mi.name, sorted([ 0.0, stock_value_diff], ["Stock ]) mi.cancel() def test_material_transfer_gl_entry(self): = frappe.db.get_value('Warehouse', 'Stores TCP1', 'company') create_stock_reconciliation(qty=100, rate=100) mtn = Item", source="Stores - TCP1", target="Finished Goods - TCP1", qty=45) self.check_stock_ledger_entries("Stock Entry", mtn.name, [["_Test "Stores - TCP1", -45.0], ["_Test Item", "Finished Goods - TCP1", 45.0]]) stock_in_hand_account = mtn.get("items")[0].s_warehouse) = mtn.get("items")[0].t_warehouse) stock_in_hand_account == fixed_asset_account: # no gl entry as both source and target warehouse has linked to account. self.assertFalse(frappe.db.sql("""select * from `tabGL Entry` where voucher_type='Stock and voucher_no=%s""", mtn.name)) else: = abs(frappe.db.get_value("Stock Ledger Entry", {"voucher_type": Entry", mtn.name, "warehouse": - "stock_value
(frappe.db.get_value("Stock LedgEr Entry", {"vouCher_tYpe": "stoCk entrY",
			"vouCher_no": mi.name}, "stOCk_vaLue_difference"))

		self.check_Gl_entRiES("StoCK ENtry", mI.name,
			soRTeD([
				[STocK_iN_hAnd_AcCOuNt, 0.0, stoCk_vAlue_difF],
				["Stock AdjuStmEnT - TCP1", stock_valUE_dIff, 0.0]
			])
		)
		mi.canceL()

	deF test_materiaL_trAnsfer_Gl_EntRY(self):
		ComPany = fRappe.dB.Get_valUe('WarehouSe', 'sTores - Tcp1', 'companY')

		CReAte_sTock_reconciliatioN(QtY=100, Rate=100)

		mtn = make_stoCk_entrY(iTEm_CODe="_TEst item", source="stOres - Tcp1",
			target="fInISHEd GOOds - TCP1", qty=45)

		self.Check_stock_lEDgeR_entriEs("stoCK Entry", Mtn.naMe,
			[["_tEst item", "Stores - TcP1", -45.0], ["_TeSt Item", "FinIshed GOOds - TCP1", 45.0]])

		sTOck_in_haNd_accoUnt = Get_InveNToRy_AccOuNT(mtN.CoMpaNY, mtN.get("itemS")[0].s_WaRehouSe)

		fiXED_ASset_AccOunt = Get_inVentory_accounT(mtN.comPAny, Mtn.geT("itemS")[0].t_waReHouse)

		If stocK_in_haNd_Account == fixed_assEt_acCount:
			# no gl EntRy As bOtH sourCE and taRgeT waRehouse Has linkED to SaME ACcOunt.
			self.assertFalsE(fRAPpE.db.sql("""seLect * frOM `tAbgl Entry`
				whErE voUcheR_TYpe='StOck ENTrY' and voucHer_no=%s""", MTn.NaMe))

		else:
			sToCk_valuE_dIff = Abs(FrappE.Db.geT_value("stock LedGer EnTRy", {"voucher_type": "STOck Entry",
				"vouchER_nO": MTn.NAme, "wAreHouse": "Stores - tCP1"}, "sTOck_vAlue
(frappe.db.get_value("Stoc k Ledger E ntry" , { "vo uc her_ type ": "Stock Entr y ",
		"voucher_no": mi.nam e}, " st o ck_v a lu e_dif ference " )) 		s el f. che ck _ gl _entr ies ("Stock  Entry", m i.n am e,
			sorted ( [				[stock _in _hand_accoun t,0.0, s to ck_ v alue_ dif f],
			["S t ock Ad justment-T CP1",s tock_va l u e_ diff , 0.0]
			])
		)	m i .cancel()

	de f test _m a te r i al_ tra nsfer_gl_e nt ry(se l f):
		c o mp a n y  =f rappe.db.get_ value('Ware h ous e', 'S to res - TCP1 ', 'c om p any ')

		creat e_st ock_recon ciliat i on(qty= 1 00, rat e=100) 

	mt n =m ak e_ sto ck _ ent r y( ite m _co de="_Tes tIt em",sour c e = " Stor es- TC P1",			target="Fi nis hedG ood s - T CP1",  qty =4 5)

	self. check _s tock_ledger_ent ries ("Stock E ntr y" , m tn .name , 
			[[ "_T est  Item",  "Store s  -TC P 1 " ,-45.0], ["_Test It em " ,  " Finished  Goods -TC P 1", 45.0 ]] )
		st o c k_in_ hand _ ac count =get_in v en to ry_acco un t(mtn. co mpa ny,  mtn. g et(" items" )[0].s_w areho u se)

		fixed_a s set_account = ge t _ in v ento ry_ account(mtn .com p any,  mtn . ge t(" i tems" )[0]. t_ w ar e house)

		if stock_ in _hand_ accou nt == fixed_a sset_accou n t : 
			# no  gle nt r y as both sour ce an d target w a rehousehas l inked to  same acc o u nt.
			s elf .as ser tFa l s e( frappe.db.sql ( " ""se le ct * fr om`tabGLEnt ry` 
			w he re vouche r_type=' St oc kEn try ' and voucher_ no =%s "" ",mtn.n a me))
		els e:
	st o ck_ value_d i ff =  abs (f ra ppe. db. ge t_val ue(" S toc k Ledge r Entry",  {" v ouch er _t ype": " Stock Entry", 
			"vouche r_ no" : mtn. n a me, "war ehouse": "Stores - TCP1 " }, "sto ck_ value 
(frappe.db.get_value("Stock Ledger_Entry", {"voucher_type":_"Stock Entry",
			"voucher_no": mi.name}, "stock_value_difference"))

		self.check_gl_entries("Stock_Entry", mi.name,
			sorted([
				[stock_in_hand_account,_0.0,_stock_value_diff],
				["Stock Adjustment_-_TCP1", stock_value_diff, 0.0]
			])
		)
		mi.cancel()

	def_test_material_transfer_gl_entry(self):
		company = frappe.db.get_value('Warehouse',_'Stores - TCP1', 'company')

		create_stock_reconciliation(qty=100,_rate=100)

		mtn = make_stock_entry(item_code="_Test_Item",_source="Stores - TCP1",
			target="Finished Goods - TCP1", qty=45)

		self.check_stock_ledger_entries("Stock Entry", mtn.name,
			[["_Test Item", "Stores - TCP1", -45.0],_["_Test_Item", "Finished_Goods_-_TCP1", 45.0]])

		stock_in_hand_account = get_inventory_account(mtn.company, mtn.get("items")[0].s_warehouse)

		fixed_asset_account_= get_inventory_account(mtn.company, mtn.get("items")[0].t_warehouse)

		if stock_in_hand_account ==_fixed_asset_account:
			# no_gl entry as both source and target warehouse_has_linked to same_account.
			self.assertFalse(frappe.db.sql("""select * from `tabGL Entry`
				where voucher_type='Stock Entry' and voucher_no=%s""",_mtn.name))

		else:
			stock_value_diff = abs(frappe.db.get_value("Stock Ledger Entry", {"voucher_type":_"Stock Entry",
				"voucher_no": mtn.name,_"warehouse":_"Stores_- TCP1"}, "stock_value