refactor: rename field `against_pick_list_item`
diff --git a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.json b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.json
index f92bf49..1a518fa 100644
--- a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.json
+++ b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.json
@@ -19,7 +19,7 @@
"column_break_7dxj",
"from_voucher_type",
"against_pick_list",
- "against_pick_list_item",
+ "from_voucher_detail_no",
"section_break_xt4m",
"stock_uom",
"column_break_grdt",
@@ -283,15 +283,6 @@
"search_index": 1
},
{
- "fieldname": "against_pick_list_item",
- "fieldtype": "Data",
- "label": "From Voucher Detail No",
- "no_copy": 1,
- "print_hide": 1,
- "read_only": 1,
- "report_hide": 1
- },
- {
"fieldname": "column_break_7dxj",
"fieldtype": "Column Break"
},
@@ -308,6 +299,15 @@
"print_hide": 1,
"read_only": 1,
"report_hide": 1
+ },
+ {
+ "fieldname": "from_voucher_detail_no",
+ "fieldtype": "Data",
+ "label": "From Voucher Detail No",
+ "no_copy": 1,
+ "print_hide": 1,
+ "read_only": 1,
+ "report_hide": 1
}
],
"hide_toolbar": 1,
@@ -315,7 +315,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
- "modified": "2023-10-19 16:09:08.418544",
+ "modified": "2023-10-19 16:26:46.598043",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Reservation Entry",
diff --git a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py
index 80f4c1e..66e246a 100644
--- a/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py
+++ b/erpnext/stock/doctype/stock_reservation_entry/stock_reservation_entry.py
@@ -316,21 +316,24 @@
) -> None:
"""Updates total reserved qty in the Pick List."""
- if self.against_pick_list and self.against_pick_list_item:
+ if (
+ self.from_voucher_type == "Pick List" and self.against_pick_list and self.from_voucher_detail_no
+ ):
sre = frappe.qb.DocType("Stock Reservation Entry")
reserved_qty = (
frappe.qb.from_(sre)
.select(Sum(sre.reserved_qty))
.where(
(sre.docstatus == 1)
+ & (sre.from_voucher_type == "Pick List")
& (sre.against_pick_list == self.against_pick_list)
- & (sre.against_pick_list_item == self.against_pick_list_item)
+ & (sre.from_voucher_detail_no == self.from_voucher_detail_no)
)
).run(as_list=True)[0][0] or 0
frappe.db.set_value(
"Pick List Item",
- self.against_pick_list_item,
+ self.from_voucher_detail_no,
reserved_qty_field,
reserved_qty,
update_modified=update_modified,
@@ -803,7 +806,7 @@
if against_pick_list:
so_item.pick_list = item.get("parent")
- so_item.pick_list_item = item.get("name")
+ so_item.from_voucher_detail_no = item.get("name")
items.append(so_item)
@@ -929,7 +932,7 @@
if against_pick_list:
sre.from_voucher_type = "Pick List"
sre.against_pick_list = item.pick_list
- sre.against_pick_list_item = item.pick_list_item
+ sre.from_voucher_detail_no = item.from_voucher_detail_no
if item.serial_and_batch_bundle:
sbb = frappe.get_doc("Serial and Batch Bundle", item.serial_and_batch_bundle)
diff --git a/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py b/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py
index 1168a4e..27f43bf 100644
--- a/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py
+++ b/erpnext/stock/doctype/stock_reservation_entry/test_stock_reservation_entry.py
@@ -555,8 +555,9 @@
(sre.voucher_type == "Sales Order")
& (sre.voucher_no == location.sales_order)
& (sre.voucher_detail_no == location.sales_order_item)
+ & (sre.from_voucher_type == "Pick List")
& (sre.against_pick_list == pl.name)
- & (sre.against_pick_list_item == location.name)
+ & (sre.from_voucher_detail_no == location.name)
)
).run(as_dict=True)
reserved_sb_details: set[tuple] = {