mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-01 20:48:27 +00:00
fix: make inv dimen reqd only in delivery note (#54546)
(cherry picked from commit 0aadd1e3a5)
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
This commit is contained in:
@@ -478,3 +478,4 @@ erpnext.patches.v16_0.uom_category
|
|||||||
erpnext.patches.v16_0.merge_repost_settings_to_accounts_settings
|
erpnext.patches.v16_0.merge_repost_settings_to_accounts_settings
|
||||||
erpnext.patches.v16_0.set_root_type_in_account_categories
|
erpnext.patches.v16_0.set_root_type_in_account_categories
|
||||||
erpnext.patches.v16_0.scr_inv_dimension
|
erpnext.patches.v16_0.scr_inv_dimension
|
||||||
|
erpnext.patches.v16_0.packed_item_inv_dimen
|
||||||
27
erpnext/patches/v16_0/packed_item_inv_dimen.py
Normal file
27
erpnext/patches/v16_0/packed_item_inv_dimen.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
from erpnext.stock.doctype.inventory_dimension.inventory_dimension import get_inventory_dimensions
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
for dimension in get_inventory_dimensions():
|
||||||
|
if frappe.db.exists(
|
||||||
|
"Custom Field",
|
||||||
|
{
|
||||||
|
"fieldname": dimension.source_fieldname,
|
||||||
|
"dt": "Packed Item",
|
||||||
|
"reqd": 1,
|
||||||
|
},
|
||||||
|
):
|
||||||
|
frappe.set_value(
|
||||||
|
"Custom Field",
|
||||||
|
{
|
||||||
|
"fieldname": dimension.source_fieldname,
|
||||||
|
"dt": "Packed Item",
|
||||||
|
"reqd": 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"reqd": 0,
|
||||||
|
"mandatory_depends_on": "eval:doc.parent_detail_docname && ['Delivery Note', 'Sales Invoice', 'POS Invoice'].includes(parent.doctype)",
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -173,6 +173,8 @@ class InventoryDimension(Document):
|
|||||||
mandatory_depends_on = "eval:doc.s_warehouse"
|
mandatory_depends_on = "eval:doc.s_warehouse"
|
||||||
elif doctype == "Subcontracting Receipt Supplied Item":
|
elif doctype == "Subcontracting Receipt Supplied Item":
|
||||||
mandatory_depends_on = "eval:doc.reference_name"
|
mandatory_depends_on = "eval:doc.reference_name"
|
||||||
|
elif doctype == "Packed Item":
|
||||||
|
mandatory_depends_on = "eval:doc.parent_detail_docname && ['Delivery Note', 'Sales Invoice', 'POS Invoice'].includes(parent.doctype)"
|
||||||
|
|
||||||
dimension_fields = [
|
dimension_fields = [
|
||||||
dict(
|
dict(
|
||||||
@@ -193,7 +195,8 @@ class InventoryDimension(Document):
|
|||||||
reqd=1
|
reqd=1
|
||||||
if self.reqd
|
if self.reqd
|
||||||
and not self.mandatory_depends_on
|
and not self.mandatory_depends_on
|
||||||
and doctype not in ["Stock Entry Detail", "Subcontracting Receipt Supplied Item"]
|
and doctype
|
||||||
|
not in ["Stock Entry Detail", "Subcontracting Receipt Supplied Item", "Packed Item"]
|
||||||
else 0,
|
else 0,
|
||||||
mandatory_depends_on=mandatory_depends_on,
|
mandatory_depends_on=mandatory_depends_on,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"parent_item",
|
"parent_item",
|
||||||
"item_code",
|
"item_code",
|
||||||
"item_name",
|
"item_name",
|
||||||
|
"delivered_by_supplier",
|
||||||
"column_break_5",
|
"column_break_5",
|
||||||
"description",
|
"description",
|
||||||
"section_break_6",
|
"section_break_6",
|
||||||
@@ -23,7 +24,6 @@
|
|||||||
"use_serial_batch_fields",
|
"use_serial_batch_fields",
|
||||||
"column_break_11",
|
"column_break_11",
|
||||||
"serial_and_batch_bundle",
|
"serial_and_batch_bundle",
|
||||||
"delivered_by_supplier",
|
|
||||||
"section_break_bgys",
|
"section_break_bgys",
|
||||||
"serial_no",
|
"serial_no",
|
||||||
"column_break_qlha",
|
"column_break_qlha",
|
||||||
@@ -119,6 +119,7 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:parent.doctype !== \"Sales Order\"",
|
||||||
"fieldname": "section_break_9",
|
"fieldname": "section_break_9",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
},
|
},
|
||||||
@@ -285,7 +286,7 @@
|
|||||||
"label": "Use Serial No / Batch Fields"
|
"label": "Use Serial No / Batch Fields"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval:doc.use_serial_batch_fields === 1",
|
"depends_on": "eval:doc.use_serial_batch_fields === 1 && parent.doctype !== \"Sales Order\"",
|
||||||
"fieldname": "section_break_bgys",
|
"fieldname": "section_break_bgys",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
},
|
},
|
||||||
@@ -314,7 +315,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2026-03-16 18:10:47.511381",
|
"modified": "2026-04-27 13:00:22.949296",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Packed Item",
|
"name": "Packed Item",
|
||||||
|
|||||||
Reference in New Issue
Block a user