refactor: misc pick list refactors
- make tracking fields read only and no-copy :facepalm:
- collapse print settings section, most users configure it once and
forget about it, not need to show this.
- call pick list grouping function directly
- use get_descendants_of instead of obscure db function
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index fe2f14e..1d0432b 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -1520,6 +1520,7 @@
"fieldname": "per_picked",
"fieldtype": "Percent",
"label": "% Picked",
+ "no_copy": 1,
"read_only": 1
}
],
@@ -1527,7 +1528,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
- "modified": "2022-03-15 21:38:31.437586",
+ "modified": "2022-04-21 08:16:48.316074",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index 195e964..8a6a0ba 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -803,13 +803,15 @@
{
"fieldname": "picked_qty",
"fieldtype": "Float",
- "label": "Picked Qty"
+ "label": "Picked Qty",
+ "no_copy": 1,
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2022-03-15 20:17:33.984799",
+ "modified": "2022-04-21 08:15:14.010319",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",
diff --git a/erpnext/stock/doctype/pick_list/pick_list.json b/erpnext/stock/doctype/pick_list/pick_list.json
index c604c71..e984c08 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.json
+++ b/erpnext/stock/doctype/pick_list/pick_list.json
@@ -114,6 +114,7 @@
"set_only_once": 1
},
{
+ "collapsible": 1,
"fieldname": "print_settings_section",
"fieldtype": "Section Break",
"label": "Print Settings"
@@ -129,7 +130,7 @@
],
"is_submittable": 1,
"links": [],
- "modified": "2021-10-05 15:08:40.369957",
+ "modified": "2022-04-21 07:56:40.646473",
"modified_by": "Administrator",
"module": "Stock",
"name": "Pick List",
@@ -199,5 +200,6 @@
],
"sort_field": "modified",
"sort_order": "DESC",
+ "states": [],
"track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 33d7745..72524f0 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -11,6 +11,7 @@
from frappe.model.document import Document
from frappe.model.mapper import map_child_doc
from frappe.utils import cint, floor, flt, today
+from frappe.utils.nestedset import get_descendants_of
from erpnext.selling.doctype.sales_order.sales_order import (
make_delivery_note as create_delivery_note_from_sales_order,
@@ -109,7 +110,7 @@
from_warehouses = None
if self.parent_warehouse:
- from_warehouses = frappe.db.get_descendants("Warehouse", self.parent_warehouse)
+ from_warehouses = get_descendants_of("Warehouse", self.parent_warehouse)
# Create replica before resetting, to handle empty table on update after submit.
locations_replica = self.get("locations")
@@ -190,8 +191,7 @@
frappe.throw(_("Qty of Finished Goods Item should be greater than 0."))
def before_print(self, settings=None):
- if self.get("group_same_items"):
- self.group_similar_items()
+ self.group_similar_items()
def group_similar_items(self):
group_item_qty = defaultdict(float)