mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 12:25:09 +00:00
Merge pull request #33499 from frappe/mergify/bp/version-13-hotfix/pr-33495
fix(stock): missing ordered_qty in get_bin_details (backport #33495)
This commit is contained in:
@@ -81,6 +81,7 @@ class TestItem(FrappeTestCase):
|
||||
def test_get_item_details(self):
|
||||
# delete modified item price record and make as per test_records
|
||||
frappe.db.sql("""delete from `tabItem Price`""")
|
||||
frappe.db.sql("""delete from `tabBin`""")
|
||||
|
||||
to_check = {
|
||||
"item_code": "_Test Item",
|
||||
@@ -101,9 +102,26 @@ class TestItem(FrappeTestCase):
|
||||
"batch_no": None,
|
||||
"uom": "_Test UOM",
|
||||
"conversion_factor": 1.0,
|
||||
"reserved_qty": 1,
|
||||
"actual_qty": 5,
|
||||
"ordered_qty": 10,
|
||||
"projected_qty": 14,
|
||||
}
|
||||
|
||||
make_test_objects("Item Price")
|
||||
make_test_objects(
|
||||
"Bin",
|
||||
[
|
||||
{
|
||||
"item_code": "_Test Item",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"reserved_qty": 1,
|
||||
"actual_qty": 5,
|
||||
"ordered_qty": 10,
|
||||
"projected_qty": 14,
|
||||
}
|
||||
],
|
||||
)
|
||||
|
||||
company = "_Test Company"
|
||||
currency = frappe.get_cached_value("Company", company, "default_currency")
|
||||
@@ -127,7 +145,7 @@ class TestItem(FrappeTestCase):
|
||||
)
|
||||
|
||||
for key, value in to_check.items():
|
||||
self.assertEqual(value, details.get(key))
|
||||
self.assertEqual(value, details.get(key), key)
|
||||
|
||||
def test_item_tax_template(self):
|
||||
expected_item_tax_template = [
|
||||
|
||||
@@ -9,18 +9,7 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
from frappe.query_builder.functions import Sum
|
||||
from frappe.utils import (
|
||||
add_days,
|
||||
cint,
|
||||
comma_or,
|
||||
cstr,
|
||||
flt,
|
||||
format_time,
|
||||
formatdate,
|
||||
getdate,
|
||||
nowdate,
|
||||
today,
|
||||
)
|
||||
from frappe.utils import cint, comma_or, cstr, flt, format_time, formatdate, getdate, nowdate
|
||||
from six import iteritems, itervalues, string_types
|
||||
|
||||
import erpnext
|
||||
@@ -2565,4 +2554,3 @@ def get_supplied_items(purchase_order):
|
||||
)
|
||||
|
||||
return supplied_item_details
|
||||
|
||||
|
||||
@@ -1160,10 +1160,10 @@ def get_bin_details(item_code, warehouse, company=None):
|
||||
bin_details = frappe.db.get_value(
|
||||
"Bin",
|
||||
{"item_code": item_code, "warehouse": warehouse},
|
||||
["projected_qty", "actual_qty", "reserved_qty"],
|
||||
["projected_qty", "actual_qty", "reserved_qty", "ordered_qty"],
|
||||
as_dict=True,
|
||||
cache=True,
|
||||
) or {"projected_qty": 0, "actual_qty": 0, "reserved_qty": 0}
|
||||
) or {"projected_qty": 0, "actual_qty": 0, "reserved_qty": 0, "ordered_qty": 0}
|
||||
if company:
|
||||
bin_details["company_total_stock"] = get_company_total_stock(item_code, company)
|
||||
return bin_details
|
||||
|
||||
Reference in New Issue
Block a user