@@ -180,13 +180,29 @@ def test_landed_cost_voucher_stock_impact(self):
180180 self .assertEqual (last_sle_after_landed_cost .stock_value - last_sle .stock_value , 50.0 )
181181
182182 def test_lcv_validates_company (self ):
183+ from erpnext import is_perpetual_inventory_enabled
184+ from erpnext .accounts .doctype .account .test_account import create_account
183185 from erpnext .stock .doctype .landed_cost_voucher .landed_cost_voucher import (
184186 IncorrectCompanyValidationError ,
185187 )
186188
187189 company_a = "_Test Company"
188190 company_b = "_Test Company with perpetual inventory"
189191
192+ srbnb = create_account (
193+ account_name = "Stock Received But Not Billed" ,
194+ account_type = "Stock Received But Not Billed" ,
195+ parent_account = "Stock Liabilities - _TC" ,
196+ company = company_a ,
197+ account_currency = "INR" ,
198+ )
199+
200+ epi = is_perpetual_inventory_enabled (company_a )
201+ company_doc = frappe .get_doc ("Company" , company_a )
202+ company_doc .enable_perpetual_inventory = 1
203+ company_doc .stock_received_but_not_billed = srbnb
204+ company_doc .save ()
205+
190206 pr = make_purchase_receipt (
191207 company = company_a ,
192208 warehouse = "Stores - _TC" ,
@@ -212,6 +228,9 @@ def test_lcv_validates_company(self):
212228 distribute_landed_cost_on_items (lcv )
213229 lcv .submit ()
214230
231+ frappe .db .set_value ("Company" , company_a , "enable_perpetual_inventory" , epi )
232+ frappe .local .enable_perpetual_inventory = {}
233+
215234 def test_landed_cost_voucher_for_zero_purchase_rate (self ):
216235 "Test impact of LCV on future stock balances."
217236 from erpnext .stock .doctype .item .test_item import make_item
0 commit comments