fix: maintain PO and PO Item ref in SCR Item
diff --git a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
index 376a936..cc99085 100644
--- a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
+++ b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
@@ -194,9 +194,11 @@
def get_mapped_subcontracting_receipt(source_name, target_doc=None):
- def update_item(obj, target, source_parent):
- target.qty = flt(obj.qty) - flt(obj.received_qty)
- target.amount = (flt(obj.qty) - flt(obj.received_qty)) * flt(obj.rate)
+ def update_item(source, target, source_parent):
+ target.purchase_order = source_parent.purchase_order
+ target.purchase_order_item = source.purchase_order_item
+ target.qty = flt(source.qty) - flt(source.received_qty)
+ target.amount = (flt(source.qty) - flt(source.received_qty)) * flt(source.rate)
target_doc = get_mapped_doc(
"Subcontracting Order",
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json
index 26a29dd..35a79a9 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json
@@ -63,7 +63,9 @@
"dimension_col_break",
"project",
"section_break_80",
- "page_break"
+ "page_break",
+ "purchase_order",
+ "purchase_order_item"
],
"fields": [
{
@@ -517,12 +519,31 @@
"label": "Reference Name",
"no_copy": 1,
"read_only": 1
+ },
+ {
+ "fieldname": "purchase_order_item",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "Purchase Order Item",
+ "no_copy": 1,
+ "read_only": 1,
+ "search_index": 1
+ },
+ {
+ "fieldname": "purchase_order",
+ "fieldtype": "Link",
+ "hidden": 1,
+ "label": "Purchase Order",
+ "no_copy": 1,
+ "options": "Purchase Order",
+ "read_only": 1,
+ "search_index": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2023-11-14 18:38:26.459669",
+ "modified": "2023-11-23 17:38:55.134685",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt Item",