From 54cfeaf35797bcda23fd569f111d686093a94891 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 23 Jun 2026 18:45:26 +0530 Subject: [PATCH 1/2] fix(selling): compare the selling Check field with 1, not a Python bool (Postgres) Customer-wise Item Price builds `ip.selling.eq(True)`, which renders `WHERE "selling" = true`. `selling` is a Check field (smallint on Postgres), and PostgreSQL has no `smallint = boolean` operator: operator does not exist: smallint = boolean MariaDB accepts it because `true` aliases to `1`. Comparing with the integer `1` (`ip.selling.eq(1)`) selects identical rows on MariaDB and is valid on PostgreSQL. --- .../report/customer_wise_item_price/customer_wise_item_price.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py b/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py index f6783abfbe5..2cd286edb7b 100644 --- a/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py +++ b/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py @@ -62,7 +62,7 @@ def fetch_item_prices( or_conditions = [] if items: and_conditions.append(ip.item_code.isin([x.item_code for x in items])) - and_conditions.append(ip.selling.eq(True)) + and_conditions.append(ip.selling.eq(1)) or_conditions.append(ip.customer.isnull()) or_conditions.append(ip.price_list.isnull()) From abe9e8beccb9fd1e774e5d008876275c9f355657 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 23 Jun 2026 18:45:27 +0530 Subject: [PATCH 2/2] fix(setup): use the stored lower-case fieldname in the Sales Person lookup (Postgres) deactivate_sales_person looks up `frappe.db.get_value("Sales Person", {"Employee": employee})`. The Sales Person field is `employee` (lower case); the lookup runs with ignore_permissions, so the capital-cased key reaches the query as the column `"Employee"`. PostgreSQL matches quoted identifiers case-sensitively and errors: column "Employee" does not exist MariaDB resolves `Employee` to the `employee` column regardless of case, so using the stored `{"employee": employee}` selects the same row on MariaDB and is valid on PostgreSQL. --- erpnext/setup/doctype/employee/employee.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/employee/employee.py b/erpnext/setup/doctype/employee/employee.py index 77f7e9bd43a..ca13ae74b92 100755 --- a/erpnext/setup/doctype/employee/employee.py +++ b/erpnext/setup/doctype/employee/employee.py @@ -427,7 +427,7 @@ def is_holiday(employee, date=None, raise_exception=True, only_non_weekly=False, def deactivate_sales_person(status: str, employee: str): frappe.has_permission("Employee", doc=employee, ptype="write", throw=True) if status == "Left": - sales_person = frappe.db.get_value("Sales Person", {"Employee": employee}) + sales_person = frappe.db.get_value("Sales Person", {"employee": employee}) if sales_person: frappe.db.set_value("Sales Person", sales_person, "enabled", 0)