From 1de4742ffb934331e333b5206009e2ed9dd0c1ab Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 18 Jan 2023 15:29:32 +0530 Subject: [PATCH] fix: local variable 'stock_rbnb' referenced before assignment --- .../subcontracting_receipt/subcontracting_receipt.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py index e8faa4868f..f4fd4de169 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py @@ -262,15 +262,17 @@ class SubcontractingReceipt(SubcontractingController): def get_gl_entries(self, warehouse_account=None): from erpnext.accounts.general_ledger import process_gl_map + if not erpnext.is_perpetual_inventory_enabled(self.company): + return [] + gl_entries = [] self.make_item_gl_entries(gl_entries, warehouse_account) return process_gl_map(gl_entries) def make_item_gl_entries(self, gl_entries, warehouse_account=None): - if erpnext.is_perpetual_inventory_enabled(self.company): - stock_rbnb = self.get_company_default("stock_received_but_not_billed") - expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation") + stock_rbnb = self.get_company_default("stock_received_but_not_billed") + expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation") warehouse_with_no_account = []