fix: remove territory from Purchase Person reports

Purchase Order, Purchase Invoice, and Purchase Receipt do not have a
territory field (unlike their selling counterparts), causing an
Unknown column SQL error. Removed territory from columns, SELECT, and
filter conditions in both Commission Summary and Transaction Summary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dipen Gala
2026-06-17 13:17:33 +05:30
parent 1138effd7c
commit 9dfb60f826
4 changed files with 2 additions and 32 deletions

View File

@@ -41,11 +41,5 @@ frappe.query_reports["Purchase Person Commission Summary"] = {
fieldtype: "Link",
options: "Supplier",
},
{
fieldname: "territory",
label: __("Territory"),
fieldtype: "Link",
options: "Territory",
},
],
};

View File

@@ -18,7 +18,6 @@ def execute(filters=None):
[
d.name,
d.supplier,
d.territory,
d.posting_date,
d.base_net_amount,
d.purchase_person,
@@ -55,13 +54,6 @@ def get_columns(filters):
"fieldtype": "Link",
"width": 140,
},
{
"label": _("Territory"),
"options": "Territory",
"fieldname": "territory",
"fieldtype": "Link",
"width": 100,
},
{"label": _("Posting Date"), "fieldname": "posting_date", "fieldtype": "Date", "width": 100},
{"label": _("Amount"), "fieldname": "amount", "fieldtype": "Currency", "width": 120},
{
@@ -106,7 +98,6 @@ def get_entries(filters):
.select(
dt.name,
dt.supplier,
dt.territory,
date_field.as_("posting_date"),
dt.base_net_total.as_("base_net_amount"),
pt.commission_rate,
@@ -133,7 +124,7 @@ def get_conditions(dt, pt, filters, date_field):
elif to_dt:
conditions.append(date_field.lte(to_dt))
for field in ["company", "supplier", "territory"]:
for field in ["company", "supplier"]:
if filters.get(field):
conditions.append(dt[field].eq(filters.get(field)))

View File

@@ -54,12 +54,6 @@ frappe.query_reports["Purchase Person-wise Transaction Summary"] = {
fieldtype: "Link",
options: "Supplier",
},
{
fieldname: "territory",
label: __("Territory"),
fieldtype: "Link",
options: "Territory",
},
{
fieldname: "show_return_entries",
label: __("Show Return Entries"),

View File

@@ -28,7 +28,6 @@ def execute(filters=None):
[
d.name,
d.supplier,
d.territory,
d.warehouse,
d.posting_date,
d.item_code,
@@ -77,13 +76,6 @@ def get_columns(filters):
"fieldtype": "Link",
"width": 140,
},
{
"label": _("Territory"),
"options": "Territory",
"fieldname": "territory",
"fieldtype": "Link",
"width": 140,
},
{
"label": _("Warehouse"),
"options": "Warehouse",
@@ -192,7 +184,6 @@ def get_entries(filters):
.select(
dt.name,
dt.supplier,
dt.territory,
dt[date_field].as_("posting_date"),
dt_item.item_code,
pt.purchase_person,
@@ -215,7 +206,7 @@ def get_entries(filters):
def get_conditions(dt, pt, filters, date_field):
conditions = []
for field in ["company", "supplier", "territory"]:
for field in ["company", "supplier"]:
if filters.get(field):
conditions.append(dt[field].eq(filters[field]))