refactor: form cleanup for master doctypes related to stock module

This commit is contained in:
Rohit Waghchaure
2026-02-05 13:47:57 +05:30
parent b719a6c767
commit 6c49d5dc7d
4 changed files with 121 additions and 42 deletions

View File

@@ -5,20 +5,25 @@
"doctype": "DocType", "doctype": "DocType",
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"item_and_warehouse_section",
"item_code", "item_code",
"column_break_yreo", "column_break_yreo",
"warehouse", "warehouse",
"section_break_stag", "available__future_inventory_section",
"actual_qty", "actual_qty",
"planned_qty", "planned_qty",
"column_break_sbzf",
"indented_qty", "indented_qty",
"ordered_qty", "ordered_qty",
"projected_qty", "reserved_inventory_section",
"column_break_xn5j",
"reserved_qty", "reserved_qty",
"reserved_qty_for_production", "reserved_qty_for_production",
"column_break_qwho",
"reserved_qty_for_sub_contract", "reserved_qty_for_sub_contract",
"reserved_qty_for_production_plan", "reserved_qty_for_production_plan",
"section_break_stag",
"projected_qty",
"column_break_xn5j",
"reserved_stock", "reserved_stock",
"section_break_pmrs", "section_break_pmrs",
"stock_uom", "stock_uom",
@@ -189,13 +194,36 @@
"fieldtype": "Float", "fieldtype": "Float",
"label": "Reserved Stock", "label": "Reserved Stock",
"read_only": 1 "read_only": 1
},
{
"fieldname": "item_and_warehouse_section",
"fieldtype": "Section Break",
"label": "Item and Warehouse"
},
{
"fieldname": "available__future_inventory_section",
"fieldtype": "Section Break",
"label": "Available / Future Inventory"
},
{
"fieldname": "column_break_sbzf",
"fieldtype": "Column Break"
},
{
"fieldname": "reserved_inventory_section",
"fieldtype": "Section Break",
"label": "Reserved Inventory"
},
{
"fieldname": "column_break_qwho",
"fieldtype": "Column Break"
} }
], ],
"hide_toolbar": 1, "hide_toolbar": 1,
"idx": 1, "idx": 1,
"in_create": 1, "in_create": 1,
"links": [], "links": [],
"modified": "2026-02-01 08:11:46.824913", "modified": "2026-02-05 17:34:44.541175",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Bin", "name": "Bin",
@@ -244,5 +272,6 @@
"search_fields": "item_code,warehouse", "search_fields": "item_code,warehouse",
"sort_field": "creation", "sort_field": "creation",
"sort_order": "ASC", "sort_order": "ASC",
"states": [] "states": [],
"title_field": "item_code"
} }

View File

@@ -3,7 +3,7 @@
"allow_import": 1, "allow_import": 1,
"allow_rename": 1, "allow_rename": 1,
"autoname": "field:item_code", "autoname": "field:item_code",
"creation": "2013-05-03 10:45:46", "creation": "2026-02-02 14:41:23.105228",
"description": "A Product or a Service that is bought, sold or kept in stock.", "description": "A Product or a Service that is bought, sold or kept in stock.",
"doctype": "DocType", "doctype": "DocType",
"document_type": "Setup", "document_type": "Setup",
@@ -16,9 +16,6 @@
"item_name", "item_name",
"item_group", "item_group",
"stock_uom", "stock_uom",
"opening_stock",
"valuation_rate",
"standard_rate",
"column_break0", "column_break0",
"disabled", "disabled",
"allow_alternative_item", "allow_alternative_item",
@@ -29,6 +26,10 @@
"is_grouped_asset", "is_grouped_asset",
"asset_category", "asset_category",
"asset_naming_series", "asset_naming_series",
"section_break_gjns",
"opening_stock",
"column_break_ixrh",
"standard_rate",
"section_break_znra", "section_break_znra",
"over_delivery_receipt_allowance", "over_delivery_receipt_allowance",
"column_break_wugd", "column_break_wugd",
@@ -41,11 +42,14 @@
"uoms", "uoms",
"dashboard_tab", "dashboard_tab",
"inventory_section", "inventory_section",
"inventory_valuation_section",
"valuation_method",
"column_break_cqdk",
"valuation_rate",
"inventory_settings_section", "inventory_settings_section",
"shelf_life_in_days", "shelf_life_in_days",
"end_of_life", "end_of_life",
"default_material_request_type", "default_material_request_type",
"valuation_method",
"column_break1", "column_break1",
"warranty_period", "warranty_period",
"weight_per_unit", "weight_per_unit",
@@ -114,19 +118,21 @@
"sales_tax_withholding_category", "sales_tax_withholding_category",
"quality_tab", "quality_tab",
"inspection_required_before_purchase", "inspection_required_before_purchase",
"quality_inspection_template",
"inspection_required_before_delivery", "inspection_required_before_delivery",
"column_break_pxjh",
"quality_inspection_template",
"manufacturing", "manufacturing",
"include_item_in_manufacturing", "include_item_in_manufacturing",
"is_sub_contracted_item", "is_sub_contracted_item",
"default_bom", "default_bom",
"column_break_74", "column_break_74",
"customer_code", "production_capacity",
"default_item_manufacturer",
"default_manufacturer_part_no",
"total_projected_qty", "total_projected_qty",
"capacity_in_days_section", "section_break_xili",
"production_capacity" "customer_code",
"column_break_vipt",
"default_manufacturer_part_no",
"default_item_manufacturer"
], ],
"fields": [ "fields": [
{ {
@@ -188,6 +194,7 @@
"fieldname": "stock_uom", "fieldname": "stock_uom",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"in_list_view": 1,
"label": "Default Unit of Measure", "label": "Default Unit of Measure",
"oldfieldname": "stock_uom", "oldfieldname": "stock_uom",
"oldfieldtype": "Link", "oldfieldtype": "Link",
@@ -218,6 +225,7 @@
"depends_on": "eval:!doc.is_fixed_asset", "depends_on": "eval:!doc.is_fixed_asset",
"fieldname": "is_stock_item", "fieldname": "is_stock_item",
"fieldtype": "Check", "fieldtype": "Check",
"in_list_view": 1,
"label": "Maintain Stock", "label": "Maintain Stock",
"oldfieldname": "is_stock_item", "oldfieldname": "is_stock_item",
"oldfieldtype": "Select" "oldfieldtype": "Select"
@@ -889,16 +897,10 @@
"fieldtype": "Column Break" "fieldtype": "Column Break"
}, },
{ {
"collapsible": 1,
"fieldname": "deferred_accounting_section", "fieldname": "deferred_accounting_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Deferred Accounting" "label": "Deferred Accounting"
}, },
{
"fieldname": "capacity_in_days_section",
"fieldtype": "Section Break",
"label": "Capacity (In Days)"
},
{ {
"fieldname": "production_capacity", "fieldname": "production_capacity",
"fieldtype": "Int", "fieldtype": "Int",
@@ -931,10 +933,10 @@
"fieldtype": "Section Break" "fieldtype": "Section Break"
}, },
{ {
"depends_on": "is_purchase_item",
"fieldname": "purchase_tax_withholding_category", "fieldname": "purchase_tax_withholding_category",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Purchase Tax Withholding Category", "label": "Purchase Tax Withholding Category",
"depends_on": "is_purchase_item",
"options": "Tax Withholding Category" "options": "Tax Withholding Category"
}, },
{ {
@@ -942,11 +944,40 @@
"fieldtype": "Column Break" "fieldtype": "Column Break"
}, },
{ {
"depends_on": "is_sales_item",
"fieldname": "sales_tax_withholding_category", "fieldname": "sales_tax_withholding_category",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Sales Tax Withholding Category", "label": "Sales Tax Withholding Category",
"depends_on": "is_sales_item",
"options": "Tax Withholding Category" "options": "Tax Withholding Category"
},
{
"fieldname": "column_break_cqdk",
"fieldtype": "Column Break"
},
{
"fieldname": "inventory_valuation_section",
"fieldtype": "Section Break",
"label": "Inventory Valuation"
},
{
"fieldname": "section_break_gjns",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_ixrh",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_pxjh",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_xili",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_vipt",
"fieldtype": "Column Break"
} }
], ],
"icon": "fa fa-tag", "icon": "fa fa-tag",
@@ -954,7 +985,7 @@
"image_field": "image", "image_field": "image",
"links": [], "links": [],
"make_attachments_public": 1, "make_attachments_public": 1,
"modified": "2025-12-15 20:08:35.634046", "modified": "2026-02-05 17:20:35.605734",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Item", "name": "Item",

View File

@@ -58,12 +58,16 @@ frappe.ui.form.on("Warehouse", {
} }
if ("Stock Balance" in frappe.boot.user.all_reports) { if ("Stock Balance" in frappe.boot.user.all_reports) {
frm.add_custom_button(__("Stock Balance"), function () { frm.add_custom_button(
frappe.set_route("query-report", "Stock Balance", { __("Stock Balance"),
warehouse: frm.doc.name, function () {
company: frm.doc.company, frappe.set_route("query-report", "Stock Balance", {
}); warehouse: frm.doc.name,
}); company: frm.doc.company,
});
},
__("View")
);
} }
} else { } else {
frappe.contacts.clear_address_and_contact(frm); frappe.contacts.clear_address_and_contact(frm);
@@ -74,13 +78,17 @@ frappe.ui.form.on("Warehouse", {
frm.doc.__onload?.account && frm.doc.__onload?.account &&
"General Ledger" in frappe.boot.user.all_reports "General Ledger" in frappe.boot.user.all_reports
) { ) {
frm.add_custom_button(__("General Ledger", null, "Warehouse"), function () { frm.add_custom_button(
frappe.route_options = { __("General Ledger", null, "Warehouse"),
account: frm.doc.__onload.account, function () {
company: frm.doc.company, frappe.route_options = {
}; account: frm.doc.__onload.account,
frappe.set_route("query-report", "General Ledger"); company: frm.doc.company,
}); };
frappe.set_route("query-report", "General Ledger");
},
__("View")
);
} }
frm.toggle_enable(["is_group", "company"], false); frm.toggle_enable(["is_group", "company"], false);

View File

@@ -12,12 +12,14 @@
"disabled", "disabled",
"warehouse_name", "warehouse_name",
"column_break_3", "column_break_3",
"is_group", "company",
"parent_warehouse",
"is_rejected_warehouse", "is_rejected_warehouse",
"column_break_4", "column_break_4",
"account", "account",
"company", "section_break_ujhu",
"parent_warehouse",
"is_group",
"column_break_qhdh",
"customer", "customer",
"address_and_contact", "address_and_contact",
"address_html", "address_html",
@@ -94,6 +96,7 @@
"description": "If blank, parent Warehouse Account or company default will be considered in transactions", "description": "If blank, parent Warehouse Account or company default will be considered in transactions",
"fieldname": "account", "fieldname": "account",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1,
"label": "Account", "label": "Account",
"options": "Account" "options": "Account"
}, },
@@ -268,6 +271,14 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Customer", "label": "Customer",
"options": "Customer" "options": "Customer"
},
{
"fieldname": "section_break_ujhu",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_qhdh",
"fieldtype": "Column Break"
} }
], ],
"grid_page_length": 50, "grid_page_length": 50,
@@ -275,7 +286,7 @@
"idx": 1, "idx": 1,
"is_tree": 1, "is_tree": 1,
"links": [], "links": [],
"modified": "2025-09-05 14:47:17.140099", "modified": "2026-02-05 18:17:11.035097",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Warehouse", "name": "Warehouse",