mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-25 21:05:19 +00:00
Negative stock allowed for perpetual inventory. Blocked in specific case
This commit is contained in:
@@ -277,6 +277,9 @@ class BuyingController(StockController):
|
||||
"qty": -1 * required_qty,
|
||||
"serial_no": rm.serial_no
|
||||
})
|
||||
if not item_rate:
|
||||
from erpnext.controllers.stock_controller import get_valuation_rate
|
||||
item_rate = get_valuation_rate(bom_item.item_code, self.supplier_warehouse)
|
||||
rm.rate = item_rate or bom_item.rate
|
||||
else:
|
||||
rm.rate = bom_item.rate
|
||||
|
||||
@@ -30,7 +30,7 @@ class StockController(AccountsController):
|
||||
def get_gl_entries(self, warehouse_account=None, default_expense_account=None,
|
||||
default_cost_center=None, allow_negative_stock=False):
|
||||
|
||||
block_negative_stock(allow_negative_stock)
|
||||
# block_negative_stock(allow_negative_stock)
|
||||
|
||||
if not warehouse_account:
|
||||
warehouse_account = get_warehouse_account()
|
||||
@@ -319,4 +319,7 @@ def get_valuation_rate(item_code, warehouse):
|
||||
if not valuation_rate:
|
||||
valuation_rate = frappe.db.get_value("Item Price", {"item_code": item_code, "buying": 1}, "price_list_rate")
|
||||
|
||||
if not valuation_rate:
|
||||
frappe.throw(_("Purchase rate for item: {0} not found, which is required to book accounting entry. Please mention item price against a buying price list.").format(item_code))
|
||||
|
||||
return valuation_rate
|
||||
|
||||
Reference in New Issue
Block a user