refactor: Cleanup buying module forms

This commit is contained in:
Rohit Waghchaure
2026-02-03 22:42:02 +05:30
parent b719a6c767
commit f3ea1863ae
6 changed files with 128 additions and 103 deletions

View File

@@ -8,12 +8,12 @@
"email_append_to": 1,
"engine": "InnoDB",
"field_order": [
"company",
"title",
"naming_series",
"supplier",
"supplier_name",
"tax_id",
"company",
"column_break_6",
"posting_date",
"posting_time",
@@ -85,20 +85,24 @@
"taxes_and_charges_added",
"taxes_and_charges_deducted",
"total_taxes_and_charges",
"section_break_49",
"totals_section",
"grand_total",
"disable_rounded_total",
"rounding_adjustment",
"column_break8",
"use_company_roundoff_cost_center",
"in_words",
"rounded_total",
"base_totals_section",
"base_grand_total",
"base_rounding_adjustment",
"base_rounded_total",
"column_break_hcca",
"base_in_words",
"column_break8",
"grand_total",
"rounding_adjustment",
"use_company_roundoff_cost_center",
"rounded_total",
"in_words",
"base_rounded_total",
"section_break_ttrv",
"total_advance",
"column_break_peap",
"outstanding_amount",
"disable_rounded_total",
"section_tax_withholding_entry",
"tax_withholding_group",
"ignore_tax_withholding_threshold",
@@ -882,15 +886,10 @@
"options": "currency",
"print_hide": 1
},
{
"fieldname": "section_break_49",
"fieldtype": "Section Break",
"label": "Totals"
},
{
"fieldname": "base_grand_total",
"fieldtype": "Currency",
"label": "Grand Total (Company Currency)",
"label": "Grand Total",
"oldfieldname": "grand_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -901,7 +900,7 @@
"depends_on": "eval:!doc.disable_rounded_total",
"fieldname": "base_rounding_adjustment",
"fieldtype": "Currency",
"label": "Rounding Adjustment (Company Currency)",
"label": "Rounding Adjustment",
"no_copy": 1,
"options": "Company:company:default_currency",
"print_hide": 1,
@@ -911,7 +910,7 @@
"depends_on": "eval:!doc.disable_rounded_total",
"fieldname": "base_rounded_total",
"fieldtype": "Currency",
"label": "Rounded Total (Company Currency)",
"label": "Rounded Total",
"no_copy": 1,
"options": "Company:company:default_currency",
"print_hide": 1,
@@ -920,7 +919,7 @@
{
"fieldname": "base_in_words",
"fieldtype": "Data",
"label": "In Words (Company Currency)",
"label": "In Words",
"length": 240,
"oldfieldname": "in_words",
"oldfieldtype": "Data",
@@ -1625,8 +1624,7 @@
"hidden": 1,
"label": "Item Wise Tax Details",
"no_copy": 1,
"options": "Item Wise Tax Detail",
"print_hide": 1
"options": "Item Wise Tax Detail"
},
{
"collapsible": 1,
@@ -1661,6 +1659,28 @@
"fieldname": "override_tax_withholding_entries",
"fieldtype": "Check",
"label": "Edit Tax Withholding Entries"
},
{
"fieldname": "column_break_hcca",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_ttrv",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_peap",
"fieldtype": "Column Break"
},
{
"fieldname": "base_totals_section",
"fieldtype": "Section Break",
"label": "Totals (Company Currency)"
},
{
"fieldname": "totals_section",
"fieldtype": "Section Break",
"label": "Totals"
}
],
"grid_page_length": 50,
@@ -1668,7 +1688,7 @@
"idx": 204,
"is_submittable": 1,
"links": [],
"modified": "2026-02-03 14:23:47.937128",
"modified": "2026-02-04 16:32:19.664287",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",

View File

@@ -461,27 +461,6 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends (
}
}
get_items_from_open_material_requests() {
erpnext.utils.map_current_doc({
method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order_based_on_supplier",
args: {
supplier: this.frm.doc.supplier,
},
source_doctype: "Material Request",
source_name: this.frm.doc.supplier,
target: this.frm,
setters: {
company: this.frm.doc.company,
},
get_query_filters: {
docstatus: ["!=", 2],
supplier: this.frm.doc.supplier,
},
get_query_method:
"erpnext.stock.doctype.material_request.material_request.get_material_requests_based_on_supplier",
});
}
validate() {
set_schedule_date(this.frm);
}

View File

@@ -9,23 +9,20 @@
"engine": "InnoDB",
"field_order": [
"supplier_section",
"company",
"title",
"naming_series",
"supplier",
"supplier_name",
"order_confirmation_no",
"order_confirmation_date",
"get_items_from_open_material_requests",
"mps",
"column_break_7",
"transaction_date",
"schedule_date",
"column_break1",
"supplier",
"company",
"is_subcontracted",
"supplier_name",
"has_unit_price_items",
"supplier_warehouse",
"amended_from",
"accounting_dimensions_section",
"cost_center",
"dimension_col_break",
@@ -79,16 +76,19 @@
"taxes_and_charges_deducted",
"total_taxes_and_charges",
"totals_section",
"grand_total",
"disable_rounded_total",
"rounding_adjustment",
"column_break4",
"in_words",
"rounded_total",
"base_totals_section",
"base_grand_total",
"base_rounding_adjustment",
"column_break_jkoz",
"base_in_words",
"base_rounded_total",
"column_break4",
"grand_total",
"rounding_adjustment",
"rounded_total",
"disable_rounded_total",
"in_words",
"section_break_tnkm",
"advance_paid",
"discount_section",
"apply_discount_on",
@@ -154,11 +154,13 @@
"auto_repeat",
"update_auto_repeat_reference",
"additional_info_section",
"is_internal_supplier",
"party_account_currency",
"represents_company",
"ref_sq",
"amended_from",
"column_break_74",
"party_account_currency",
"mps",
"is_internal_supplier",
"inter_company_order_reference",
"is_old_subcontracting_flow",
"connections_tab"
@@ -206,13 +208,6 @@
"reqd": 1,
"search_index": 1
},
{
"depends_on": "eval:doc.supplier && doc.docstatus===0 && (!(doc.items && doc.items.length) || (doc.items.length==1 && !doc.items[0].item_code))",
"description": "Fetch items based on Default Supplier.",
"fieldname": "get_items_from_open_material_requests",
"fieldtype": "Button",
"label": "Get Items from Open Material Requests"
},
{
"bold": 1,
"fetch_from": "supplier.supplier_name",
@@ -773,7 +768,7 @@
{
"fieldname": "base_grand_total",
"fieldtype": "Currency",
"label": "Grand Total (Company Currency)",
"label": "Grand Total",
"no_copy": 1,
"oldfieldname": "grand_total",
"oldfieldtype": "Currency",
@@ -785,7 +780,7 @@
"depends_on": "eval:!doc.disable_rounded_total",
"fieldname": "base_rounding_adjustment",
"fieldtype": "Currency",
"label": "Rounding Adjustment (Company Currency)",
"label": "Rounding Adjustment",
"no_copy": 1,
"options": "Company:company:default_currency",
"print_hide": 1,
@@ -794,7 +789,7 @@
{
"fieldname": "base_in_words",
"fieldtype": "Data",
"label": "In Words (Company Currency)",
"label": "In Words",
"length": 240,
"oldfieldname": "in_words",
"oldfieldtype": "Data",
@@ -804,7 +799,7 @@
{
"fieldname": "base_rounded_total",
"fieldtype": "Currency",
"label": "Rounded Total (Company Currency)",
"label": "Rounded Total",
"oldfieldname": "rounded_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -862,7 +857,7 @@
{
"fieldname": "advance_paid",
"fieldtype": "Currency",
"label": "Advance Paid",
"label": "Advance Paid (Company Currency)",
"no_copy": 1,
"options": "party_account_currency",
"print_hide": 1,
@@ -1301,8 +1296,21 @@
"hidden": 1,
"label": "Item Wise Tax Details",
"no_copy": 1,
"options": "Item Wise Tax Detail",
"print_hide": 1
"options": "Item Wise Tax Detail"
},
{
"fieldname": "column_break_jkoz",
"fieldtype": "Column Break"
},
{
"fieldname": "base_totals_section",
"fieldtype": "Section Break",
"label": "Totals (Company Currency)",
"options": "Company:company:default_currency"
},
{
"fieldname": "section_break_tnkm",
"fieldtype": "Section Break"
}
],
"grid_page_length": 50,
@@ -1310,7 +1318,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2026-02-03 14:44:55.192192",
"modified": "2026-02-04 13:01:36.628472",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",

View File

@@ -1733,13 +1733,11 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
this.frm.set_currency_labels(
[
"advance_paid",
"base_total",
"base_net_total",
"base_total_taxes_and_charges",
"base_discount_amount",
"base_grand_total",
"base_rounded_total",
"base_in_words",
"base_taxes_and_charges_added",
"base_taxes_and_charges_deducted",
"total_amount_to_pay",
@@ -1750,7 +1748,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
"base_raw_material_cost",
"base_total_cost",
"base_scrap_material_cost",
"base_rounding_adjustment",
"base_totals_section",
],
company_currency
);
@@ -1761,19 +1759,16 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
"net_total",
"total_taxes_and_charges",
"discount_amount",
"grand_total",
"taxes_and_charges_added",
"taxes_and_charges_deducted",
"tax_withholding_net_total",
"rounded_total",
"in_words",
"paid_amount",
"write_off_amount",
"operating_cost",
"scrap_material_cost",
"rounding_adjustment",
"raw_material_cost",
"total_cost",
"totals_section",
],
this.frm.doc.currency
);
@@ -1827,6 +1822,19 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
this.frm.doc.price_list_currency != company_currency
);
let taxes_fields = [
"total_taxes_and_charges",
"taxes_and_charges_deducted",
"taxes_and_charges_added",
"base_taxes_and_charges_added",
"base_taxes_and_charges_deducted",
"base_total_taxes_and_charges",
];
taxes_fields.forEach((field) => {
this.frm.toggle_display(field, this.frm.doc[field] !== 0 || this.frm.doc.docstatus !== 1);
});
let show =
cint(this.frm.doc.discount_amount) ||
(this.frm.doc.taxes || []).filter(function (d) {

View File

@@ -77,17 +77,19 @@
"taxes_and_charges_added",
"taxes_and_charges_deducted",
"total_taxes_and_charges",
"section_break_46",
"totals_section",
"grand_total",
"disable_rounded_total",
"rounding_adjustment",
"column_break_50",
"in_words",
"rounded_total",
"base_totals_section",
"base_grand_total",
"base_rounding_adjustment",
"base_rounded_total",
"column_break_ugyv",
"base_in_words",
"column_break_50",
"grand_total",
"rounding_adjustment",
"rounded_total",
"in_words",
"disable_rounded_total",
"base_rounded_total",
"section_break_42",
"apply_discount_on",
"base_discount_amount",
@@ -772,15 +774,10 @@
"options": "currency",
"print_hide": 1
},
{
"fieldname": "section_break_46",
"fieldtype": "Section Break",
"label": "Totals"
},
{
"fieldname": "base_grand_total",
"fieldtype": "Currency",
"label": "Grand Total (Company Currency)",
"label": "Grand Total",
"oldfieldname": "grand_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -791,7 +788,7 @@
"depends_on": "eval:!doc.disable_rounded_total",
"fieldname": "base_rounding_adjustment",
"fieldtype": "Currency",
"label": "Rounding Adjustment (Company Currency)",
"label": "Rounding Adjustment",
"no_copy": 1,
"options": "Company:company:default_currency",
"print_hide": 1,
@@ -800,7 +797,7 @@
{
"fieldname": "base_in_words",
"fieldtype": "Data",
"label": "In Words (Company Currency)",
"label": "In Words",
"length": 240,
"oldfieldname": "in_words",
"oldfieldtype": "Data",
@@ -810,7 +807,7 @@
{
"fieldname": "base_rounded_total",
"fieldtype": "Currency",
"label": "Rounded Total (Company Currency)",
"label": "Rounded Total",
"oldfieldname": "rounded_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -1282,8 +1279,22 @@
"hidden": 1,
"label": "Item Wise Tax Details",
"no_copy": 1,
"options": "Item Wise Tax Detail",
"print_hide": 1
"options": "Item Wise Tax Detail"
},
{
"fieldname": "totals_section",
"fieldtype": "Section Break",
"label": "Totals"
},
{
"fieldname": "base_totals_section",
"fieldtype": "Section Break",
"label": "Totals (Company Currency)",
"options": "Company:company:default_currency"
},
{
"fieldname": "column_break_ugyv",
"fieldtype": "Column Break"
}
],
"grid_page_length": 50,
@@ -1291,7 +1302,7 @@
"idx": 261,
"is_submittable": 1,
"links": [],
"modified": "2026-01-29 21:24:30.652933",
"modified": "2026-02-04 14:36:41.087460",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt",

View File

@@ -146,7 +146,7 @@
},
{
"bold": 1,
"columns": 3,
"columns": 2,
"fieldname": "item_code",
"fieldtype": "Link",
"in_global_search": 1,
@@ -436,7 +436,6 @@
"columns": 2,
"fieldname": "net_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Net Amount",
"options": "currency",
"print_hide": 1,
@@ -1141,7 +1140,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2025-10-21 10:39:32.659933",
"modified": "2026-02-04 14:42:10.646809",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",