mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-09 09:55:08 +00:00
fix: hide fields related to track Semi-Finished Goods if feature has disabled
(cherry picked from commit 399faf0ced)
This commit is contained in:
committed by
Mergify
parent
53fc0beae5
commit
5a7d0d2765
@@ -19,6 +19,21 @@ frappe.ui.form.on("BOM", {
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("workstation", "operations", function (doc, cdt, cdn) {
|
||||
let row = locals[cdt][cdn];
|
||||
let filters = {
|
||||
disabled: 0,
|
||||
};
|
||||
|
||||
if (row.workstation_type) {
|
||||
filters.workstation_type = row.workstation_type;
|
||||
}
|
||||
|
||||
return {
|
||||
filters: filters,
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("operation", "items", function () {
|
||||
if (!frm.doc.operations?.length) {
|
||||
frappe.throw(__("Please add Operations first."));
|
||||
@@ -123,7 +138,16 @@ frappe.ui.form.on("BOM", {
|
||||
},
|
||||
|
||||
toggle_fields_for_semi_finished_goods(frm) {
|
||||
let fields = ["finished_good", "finished_good_qty", "bom_no"];
|
||||
let fields = [
|
||||
"finished_good",
|
||||
"finished_good_qty",
|
||||
"bom_no",
|
||||
"skip_material_transfer",
|
||||
"wip_warehouse",
|
||||
"fg_warehouse",
|
||||
"is_subcontracted",
|
||||
"is_final_finished_good",
|
||||
];
|
||||
|
||||
fields.forEach((field) => {
|
||||
frm.fields_dict["operations"].grid.update_docfield_property(
|
||||
@@ -131,9 +155,21 @@ frappe.ui.form.on("BOM", {
|
||||
"read_only",
|
||||
!frm.doc.track_semi_finished_goods
|
||||
);
|
||||
|
||||
frm.fields_dict["operations"].grid.update_docfield_property(
|
||||
field,
|
||||
"in_list_view",
|
||||
frm.doc.track_semi_finished_goods
|
||||
);
|
||||
|
||||
frm.fields_dict["operations"].grid.update_docfield_property(
|
||||
field,
|
||||
"hidden",
|
||||
!frm.doc.track_semi_finished_goods
|
||||
);
|
||||
});
|
||||
|
||||
refresh_field("operations");
|
||||
frm.fields_dict["operations"].grid.reset_grid();
|
||||
},
|
||||
|
||||
with_operations: function (frm) {
|
||||
@@ -173,6 +209,8 @@ frappe.ui.form.on("BOM", {
|
||||
refresh(frm) {
|
||||
frm.toggle_enable("item", frm.doc.__islocal);
|
||||
|
||||
frm.trigger("toggle_fields_for_semi_finished_goods");
|
||||
|
||||
frm.set_indicator_formatter("item_code", function (doc) {
|
||||
if (doc.original_item) {
|
||||
return doc.item_code != doc.original_item ? "orange" : "";
|
||||
@@ -864,6 +902,11 @@ frappe.ui.form.on("BOM Operation", "workstation", function (frm, cdt, cdn) {
|
||||
frappe.ui.form.on("BOM Operation", "workstation_type", function (frm, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (!d.workstation_type) return;
|
||||
|
||||
if (d.workstation) {
|
||||
frappe.model.set_value(cdt, cdn, "workstation", "");
|
||||
}
|
||||
|
||||
frappe.call({
|
||||
method: "frappe.client.get",
|
||||
args: {
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
},
|
||||
{
|
||||
"columns": 2,
|
||||
"depends_on": "eval:!doc.workstation_type",
|
||||
"fieldname": "workstation",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
@@ -297,7 +296,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2026-02-17 15:33:28.495850",
|
||||
"modified": "2026-03-31 17:09:48.771834",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "BOM Operation",
|
||||
|
||||
Reference in New Issue
Block a user