mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 03:09:09 +00:00
fix(perpetual inventory): Get warehouse account map only if perpetual inventory enabled (#15743)
* fix(perpetual inventory): Get warehouse account map only if perpetual inventory enabled * fix(perpetual inventory): Get warehouse account map only if perpetual inventory enabled
This commit is contained in:
@@ -209,7 +209,8 @@ class PurchaseInvoice(BuyingController):
|
|||||||
if self.update_stock:
|
if self.update_stock:
|
||||||
self.validate_item_code()
|
self.validate_item_code()
|
||||||
self.validate_warehouse()
|
self.validate_warehouse()
|
||||||
warehouse_account = get_warehouse_account_map()
|
if auto_accounting_for_stock:
|
||||||
|
warehouse_account = get_warehouse_account_map()
|
||||||
|
|
||||||
for item in self.get("items"):
|
for item in self.get("items"):
|
||||||
# in case of auto inventory accounting,
|
# in case of auto inventory accounting,
|
||||||
@@ -402,7 +403,8 @@ class PurchaseInvoice(BuyingController):
|
|||||||
# item gl entries
|
# item gl entries
|
||||||
stock_items = self.get_stock_items()
|
stock_items = self.get_stock_items()
|
||||||
expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
|
expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
|
||||||
warehouse_account = get_warehouse_account_map()
|
if self.update_stock and self.auto_accounting_for_stock:
|
||||||
|
warehouse_account = get_warehouse_account_map()
|
||||||
|
|
||||||
voucher_wise_stock_value = {}
|
voucher_wise_stock_value = {}
|
||||||
if self.update_stock:
|
if self.update_stock:
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ def get_warehouse_account(warehouse, warehouse_account=None):
|
|||||||
if not account and warehouse.company:
|
if not account and warehouse.company:
|
||||||
account = get_company_default_inventory_account(warehouse.company)
|
account = get_company_default_inventory_account(warehouse.company)
|
||||||
|
|
||||||
if not account:
|
if not account and warehouse.company:
|
||||||
frappe.throw(_("Please set Account in Warehouse {0} or Default Inventory Account in Company {1}")
|
frappe.throw(_("Please set Account in Warehouse {0} or Default Inventory Account in Company {1}")
|
||||||
.format(warehouse, warehouse.company))
|
.format(warehouse.name, warehouse.company))
|
||||||
return account
|
return account
|
||||||
|
|
||||||
def get_company_default_inventory_account(company):
|
def get_company_default_inventory_account(company):
|
||||||
|
|||||||
@@ -22,10 +22,11 @@ class Warehouse(NestedSet):
|
|||||||
|
|
||||||
def onload(self):
|
def onload(self):
|
||||||
'''load account name for General Ledger Report'''
|
'''load account name for General Ledger Report'''
|
||||||
account = self.account or get_warehouse_account(self)
|
if self.company and cint(frappe.db.get_value("Company", self.company, "enable_perpetual_inventory")):
|
||||||
|
account = self.account or get_warehouse_account(self)
|
||||||
|
|
||||||
if account:
|
if account:
|
||||||
self.set_onload('account', account)
|
self.set_onload('account', account)
|
||||||
load_address_and_contact(self)
|
load_address_and_contact(self)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user