mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-19 06:45:11 +00:00
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com> fix: inventory dimension patch (#54141)
This commit is contained in:
@@ -40,28 +40,45 @@ def get_display_depends_on(doctype):
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
for dimension in get_inventory_dimensions():
|
for dimension in get_inventory_dimensions():
|
||||||
frappe.set_value(
|
if frappe.db.exists(
|
||||||
"Custom Field",
|
"Custom Field", {"fieldname": dimension.source_fieldname, "dt": "Stock Entry Detail"}
|
||||||
{"fieldname": dimension.source_fieldname, "dt": "Stock Entry Detail"},
|
):
|
||||||
"depends_on",
|
frappe.set_value(
|
||||||
"eval:doc.s_warehouse",
|
"Custom Field",
|
||||||
)
|
{"fieldname": dimension.source_fieldname, "dt": "Stock Entry Detail"},
|
||||||
frappe.set_value(
|
"depends_on",
|
||||||
"Custom Field",
|
"eval:doc.s_warehouse",
|
||||||
{"fieldname": dimension.source_fieldname, "dt": "Stock Entry Detail", "reqd": 1},
|
)
|
||||||
{"mandatory_depends_on": "eval:doc.s_warehouse", "reqd": 0},
|
if frappe.db.exists(
|
||||||
)
|
"Custom Field", {"fieldname": dimension.source_fieldname, "dt": "Stock Entry Detail", "reqd": 1}
|
||||||
frappe.set_value(
|
):
|
||||||
|
frappe.set_value(
|
||||||
|
"Custom Field",
|
||||||
|
{"fieldname": dimension.source_fieldname, "dt": "Stock Entry Detail", "reqd": 1},
|
||||||
|
{"mandatory_depends_on": "eval:doc.s_warehouse", "reqd": 0},
|
||||||
|
)
|
||||||
|
if frappe.db.exists(
|
||||||
"Custom Field",
|
"Custom Field",
|
||||||
{
|
{
|
||||||
"fieldname": f"to_{dimension.fieldname}",
|
"fieldname": f"to_{dimension.fieldname}",
|
||||||
"dt": "Stock Entry Detail",
|
"dt": "Stock Entry Detail",
|
||||||
"depends_on": "eval:parent.purpose != 'Material Issue'",
|
"depends_on": "eval:parent.purpose != 'Material Issue'",
|
||||||
},
|
},
|
||||||
"depends_on",
|
):
|
||||||
"eval:doc.t_warehouse",
|
frappe.set_value(
|
||||||
)
|
"Custom Field",
|
||||||
if display_depends_on := get_display_depends_on(dimension.doctype):
|
{
|
||||||
|
"fieldname": f"to_{dimension.fieldname}",
|
||||||
|
"dt": "Stock Entry Detail",
|
||||||
|
"depends_on": "eval:parent.purpose != 'Material Issue'",
|
||||||
|
},
|
||||||
|
"depends_on",
|
||||||
|
"eval:doc.t_warehouse",
|
||||||
|
)
|
||||||
|
if (display_depends_on := get_display_depends_on(dimension.doctype)) and frappe.db.exists(
|
||||||
|
"Custom Field",
|
||||||
|
{"fieldname": dimension.fieldname, "dt": dimension.doctype},
|
||||||
|
):
|
||||||
frappe.set_value(
|
frappe.set_value(
|
||||||
"Custom Field",
|
"Custom Field",
|
||||||
{"fieldname": dimension.fieldname, "dt": dimension.doctype},
|
{"fieldname": dimension.fieldname, "dt": dimension.doctype},
|
||||||
|
|||||||
Reference in New Issue
Block a user