diff --git a/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/__init__.py b/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/purchase_partner_target_variance_based_on_item_group.js b/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/purchase_partner_target_variance_based_on_item_group.js new file mode 100644 index 00000000000..6dab90e5dd9 --- /dev/null +++ b/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/purchase_partner_target_variance_based_on_item_group.js @@ -0,0 +1,60 @@ +// Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and Contributors +// License: GNU General Public License v3. See license.txt + +frappe.query_reports["Purchase Partner Target Variance Based On Item Group"] = { + filters: [ + { + fieldname: "company", + label: __("Company"), + fieldtype: "Link", + options: "Company", + default: frappe.defaults.get_user_default("Company"), + }, + { + fieldname: "fiscal_year", + label: __("Fiscal Year"), + fieldtype: "Link", + options: "Fiscal Year", + default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()), + }, + { + fieldname: "doctype", + label: __("Document Type"), + fieldtype: "Select", + options: "Purchase Order\nPurchase Receipt\nPurchase Invoice", + default: "Purchase Order", + }, + { + fieldname: "period", + label: __("Period"), + fieldtype: "Select", + options: [ + { value: "Monthly", label: __("Monthly") }, + { value: "Quarterly", label: __("Quarterly") }, + { value: "Half-Yearly", label: __("Half-Yearly") }, + { value: "Yearly", label: __("Yearly") }, + ], + default: "Monthly", + }, + { + fieldname: "target_on", + label: __("Target On"), + fieldtype: "Select", + options: "Quantity\nAmount", + default: "Quantity", + }, + ], + formatter: function (value, row, column, data, default_formatter) { + value = default_formatter(value, row, column, data); + + if (column.fieldname.includes("variance")) { + if (data[column.fieldname] < 0) { + value = "" + value + ""; + } else if (data[column.fieldname] > 0) { + value = "" + value + ""; + } + } + + return value; + }, +}; diff --git a/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/purchase_partner_target_variance_based_on_item_group.json b/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/purchase_partner_target_variance_based_on_item_group.json new file mode 100644 index 00000000000..7f94d84c2f1 --- /dev/null +++ b/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/purchase_partner_target_variance_based_on_item_group.json @@ -0,0 +1,33 @@ +{ + "add_total_row": 0, + "creation": "2026-06-17 00:00:00", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2026-06-17 00:00:00", + "modified_by": "Administrator", + "module": "Buying", + "name": "Purchase Partner Target Variance Based On Item Group", + "owner": "Administrator", + "prepared_report": 0, + "ref_doctype": "Purchase Order", + "report_name": "Purchase Partner Target Variance Based On Item Group", + "report_type": "Script Report", + "roles": [ + { + "role": "Purchase User" + }, + { + "role": "Purchase Manager" + }, + { + "role": "Accounts User" + }, + { + "role": "Stock User" + } + ] +} diff --git a/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/purchase_partner_target_variance_based_on_item_group.py b/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/purchase_partner_target_variance_based_on_item_group.py new file mode 100644 index 00000000000..a4826d53920 --- /dev/null +++ b/erpnext/buying/report/purchase_partner_target_variance_based_on_item_group/purchase_partner_target_variance_based_on_item_group.py @@ -0,0 +1,11 @@ +# Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + + +from erpnext.selling.report.sales_partner_target_variance_based_on_item_group.item_group_wise_sales_target_variance import ( + get_data_column, +) + + +def execute(filters=None): + return get_data_column(filters, "Purchase Partner") diff --git a/erpnext/buying/workspace/buying/buying.json b/erpnext/buying/workspace/buying/buying.json index 6f8ce289fa9..a443743ae09 100644 --- a/erpnext/buying/workspace/buying/buying.json +++ b/erpnext/buying/workspace/buying/buying.json @@ -455,6 +455,17 @@ "onboard": 0, "type": "Link" }, + { + "dependencies": "Purchase Partner", + "hidden": 0, + "is_query_report": 1, + "label": "Purchase Partner Target Variance Based On Item Group", + "link_count": 0, + "link_to": "Purchase Partner Target Variance Based On Item Group", + "link_type": "Report", + "onboard": 0, + "type": "Link" + }, { "hidden": 0, "is_query_report": 0, @@ -637,7 +648,7 @@ "type": "Link" } ], - "modified": "2026-06-17 13:01:33.296280", + "modified": "2026-06-17 13:13:38.489837", "modified_by": "Administrator", "module": "Buying", "name": "Buying",