add supplier group filter in purchase register (#38421)
* add supplier group field in purchase register
* Update purchase_register.js
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 09bffff..f85fc87 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -189,6 +189,7 @@
"additional_info_section",
"is_internal_supplier",
"represents_company",
+ "supplier_group",
"column_break_147",
"inter_company_invoice_reference",
"is_old_subcontracting_flow",
@@ -1598,13 +1599,20 @@
"fieldtype": "Check",
"label": "Use Transaction Date Exchange Rate",
"read_only": 1
+ },
+ {
+ "fetch_from": "supplier.supplier_group",
+ "fieldname": "supplier_group",
+ "fieldtype": "Link",
+ "label": "Supplier Group",
+ "options": "Supplier Group"
}
],
"icon": "fa fa-file-text",
"idx": 204,
"is_submittable": 1,
"links": [],
- "modified": "2023-11-03 15:47:30.319200",
+ "modified": "2023-11-29 15:35:44.697496",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
@@ -1667,4 +1675,4 @@
"timeline_field": "supplier",
"title_field": "title",
"track_changes": 1
-}
+}
\ No newline at end of file
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.js b/erpnext/accounts/report/purchase_register/purchase_register.js
index 57cb703..cf11ed0 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.js
+++ b/erpnext/accounts/report/purchase_register/purchase_register.js
@@ -23,6 +23,12 @@
"options": "Supplier"
},
{
+ "fieldname":"supplier_group",
+ "label": __("Supplier Group"),
+ "fieldtype": "Link",
+ "options": "Supplier Group"
+ },
+ {
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index 162e5b5..9721987 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -407,6 +407,8 @@
if filters.get("supplier"):
query = query.where(pi.supplier == filters.supplier)
+ if filters.get("supplier_group"):
+ query = query.where(pi.supplier_group == filters.supplier_group)
query = get_conditions(filters, query, "Purchase Invoice")