fix: use transaction_date for Purchase Order in target variance helper

The shared get_data helper defaulted to posting_date for any doctype
other than Sales Order. Purchase Order also uses transaction_date, so
add it to the in-check to prevent the Unknown column SQL error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dipen Gala
2026-06-17 14:40:38 +05:30
parent 1631985726
commit 87b65d09df

View File

@@ -55,7 +55,9 @@ def get_data(filters, period_list, partner_doctype):
if d.item_group:
sales_user_wise_item_groups[d.parent].append(d.item_group)
date_field = "transaction_date" if filters.get("doctype") == "Sales Order" else "posting_date"
date_field = (
"transaction_date" if filters.get("doctype") in ("Sales Order", "Purchase Order") else "posting_date"
)
actual_data = get_actual_data(filters, sales_users, date_field, sales_field)