mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
Merge pull request #47997 from frappe/version-14-hotfix
chore: release v14
This commit is contained in:
@@ -1115,6 +1115,7 @@ def get_subitems(
|
|||||||
item_default.default_warehouse,
|
item_default.default_warehouse,
|
||||||
item.purchase_uom,
|
item.purchase_uom,
|
||||||
item_uom.conversion_factor,
|
item_uom.conversion_factor,
|
||||||
|
bom.item.as_("main_bom_item"),
|
||||||
)
|
)
|
||||||
.where(
|
.where(
|
||||||
(bom.name == bom_no)
|
(bom.name == bom_no)
|
||||||
@@ -1228,6 +1229,7 @@ def get_material_request_items(
|
|||||||
"sales_order": sales_order,
|
"sales_order": sales_order,
|
||||||
"description": row.get("description"),
|
"description": row.get("description"),
|
||||||
"uom": row.get("purchase_uom") or row.get("stock_uom"),
|
"uom": row.get("purchase_uom") or row.get("stock_uom"),
|
||||||
|
"main_bom_item": row.get("main_bom_item"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1322,20 +1322,20 @@ def stop_unstop(work_order, status):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def query_sales_order(production_item):
|
def query_sales_order(production_item: str) -> list[str]:
|
||||||
out = frappe.db.sql_list(
|
return frappe.get_list(
|
||||||
"""
|
"Sales Order",
|
||||||
select distinct so.name from `tabSales Order` so, `tabSales Order Item` so_item
|
filters=[
|
||||||
where so_item.parent=so.name and so_item.item_code=%s and so.docstatus=1
|
["Sales Order", "docstatus", "=", 1],
|
||||||
union
|
],
|
||||||
select distinct so.name from `tabSales Order` so, `tabPacked Item` pi_item
|
or_filters=[
|
||||||
where pi_item.parent=so.name and pi_item.item_code=%s and so.docstatus=1
|
["Sales Order Item", "item_code", "=", production_item],
|
||||||
""",
|
["Packed Item", "item_code", "=", production_item],
|
||||||
(production_item, production_item),
|
],
|
||||||
|
pluck="name",
|
||||||
|
distinct=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
return out
|
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_job_card(work_order, operations):
|
def make_job_card(work_order, operations):
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ def get_bom_stock(filters):
|
|||||||
BOM_ITEM.stock_qty,
|
BOM_ITEM.stock_qty,
|
||||||
BOM_ITEM.stock_uom,
|
BOM_ITEM.stock_uom,
|
||||||
BOM_ITEM.stock_qty * qty_to_produce / BOM.quantity,
|
BOM_ITEM.stock_qty * qty_to_produce / BOM.quantity,
|
||||||
Sum(BIN.actual_qty).as_("actual_qty"),
|
BIN.actual_qty.as_("actual_qty"),
|
||||||
Sum(Floor(BIN.actual_qty / (BOM_ITEM.stock_qty * qty_to_produce / BOM.quantity))),
|
Sum(Floor(BIN.actual_qty / (BOM_ITEM.stock_qty * qty_to_produce / BOM.quantity))),
|
||||||
)
|
)
|
||||||
.where((BOM_ITEM.parent == filters.get("bom")) & (BOM_ITEM.parenttype == "BOM"))
|
.where((BOM_ITEM.parent == filters.get("bom")) & (BOM_ITEM.parenttype == "BOM"))
|
||||||
|
|||||||
@@ -1266,6 +1266,11 @@ def make_raw_material_request(items, company, sales_order, project=None):
|
|||||||
|
|
||||||
items.update({"company": company, "sales_order": sales_order})
|
items.update({"company": company, "sales_order": sales_order})
|
||||||
|
|
||||||
|
item_wh = {}
|
||||||
|
for item in items.get("items"):
|
||||||
|
if item.get("warehouse"):
|
||||||
|
item_wh[item.get("item_code")] = item.get("warehouse")
|
||||||
|
|
||||||
raw_materials = get_items_for_material_requests(items)
|
raw_materials = get_items_for_material_requests(items)
|
||||||
if not raw_materials:
|
if not raw_materials:
|
||||||
frappe.msgprint(_("Material Request not created, as quantity for Raw Materials already available."))
|
frappe.msgprint(_("Material Request not created, as quantity for Raw Materials already available."))
|
||||||
@@ -1290,7 +1295,7 @@ def make_raw_material_request(items, company, sales_order, project=None):
|
|||||||
"item_code": item.get("item_code"),
|
"item_code": item.get("item_code"),
|
||||||
"qty": item.get("quantity"),
|
"qty": item.get("quantity"),
|
||||||
"schedule_date": schedule_date,
|
"schedule_date": schedule_date,
|
||||||
"warehouse": item.get("warehouse"),
|
"warehouse": item_wh.get(item.get("main_bom_item")) or item.get("warehouse"),
|
||||||
"sales_order": sales_order,
|
"sales_order": sales_order,
|
||||||
"project": project,
|
"project": project,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -489,6 +489,10 @@ class StockReconciliation(StockController):
|
|||||||
|
|
||||||
self.update_inventory_dimensions(row, data)
|
self.update_inventory_dimensions(row, data)
|
||||||
|
|
||||||
|
if self.docstatus == 1 and has_dimensions and not row.batch_no:
|
||||||
|
data.qty_after_transaction = data.actual_qty
|
||||||
|
data.actual_qty = 0.0
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def make_sle_on_cancel(self):
|
def make_sle_on_cancel(self):
|
||||||
|
|||||||
@@ -159,10 +159,11 @@ def assign_item_groups_to_svd_list(svd_list: SVDList) -> None:
|
|||||||
|
|
||||||
def get_item_groups_map(svd_list: SVDList) -> dict[str, str]:
|
def get_item_groups_map(svd_list: SVDList) -> dict[str, str]:
|
||||||
item_codes = set(i["item_code"] for i in svd_list)
|
item_codes = set(i["item_code"] for i in svd_list)
|
||||||
ig_list = frappe.get_list(
|
return frappe._dict(
|
||||||
"Item", fields=["item_code", "item_group"], filters=[("item_code", "in", item_codes)]
|
frappe.get_all(
|
||||||
|
"Item", fields=["name", "item_group"], filters=[("name", "in", item_codes)], as_list=True
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return {i["item_code"]: i["item_group"] for i in ig_list}
|
|
||||||
|
|
||||||
|
|
||||||
def get_item_groups_dict() -> ItemGroupsDict:
|
def get_item_groups_dict() -> ItemGroupsDict:
|
||||||
|
|||||||
@@ -655,8 +655,11 @@ class update_entries_after:
|
|||||||
if not sle.is_adjustment_entry:
|
if not sle.is_adjustment_entry:
|
||||||
sle.stock_value_difference = stock_value_difference
|
sle.stock_value_difference = stock_value_difference
|
||||||
elif sle.is_adjustment_entry and not self.args.get("sle_id"):
|
elif sle.is_adjustment_entry and not self.args.get("sle_id"):
|
||||||
sle.stock_value_difference = get_stock_value_difference(
|
sle.stock_value_difference = (
|
||||||
sle.item_code, sle.warehouse, sle.posting_date, sle.posting_time, sle.voucher_no
|
get_stock_value_difference(
|
||||||
|
sle.item_code, sle.warehouse, sle.posting_date, sle.posting_time, sle.voucher_no
|
||||||
|
)
|
||||||
|
* -1
|
||||||
)
|
)
|
||||||
|
|
||||||
sle.doctype = "Stock Ledger Entry"
|
sle.doctype = "Stock Ledger Entry"
|
||||||
|
|||||||
@@ -109,6 +109,8 @@ def get_stock_balance(
|
|||||||
|
|
||||||
from erpnext.stock.stock_ledger import get_previous_sle
|
from erpnext.stock.stock_ledger import get_previous_sle
|
||||||
|
|
||||||
|
frappe.has_permission("Item", "read", throw=True)
|
||||||
|
|
||||||
if posting_date is None:
|
if posting_date is None:
|
||||||
posting_date = nowdate()
|
posting_date = nowdate()
|
||||||
if posting_time is None:
|
if posting_time is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user