From 355ba2f6324c14de3adfdae398089d7c11903347 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 13:38:43 +0530 Subject: [PATCH] fix: the purchase receipt trends and delivery note trends report (backport #43585) (#43587) * fix: fix the purchase receipt trends and delivery note trends report (cherry picked from commit 2e9dda1588533d425ec3b22b089fcafebb17856d) * fix: trends date filter issue --formatter (cherry picked from commit b3e4463a4f53c8949b165374d2d70e135c07b1e5) --------- Co-authored-by: Vishv-silveroak <108357657+Vishv-024@users.noreply.github.com> Co-authored-by: Nihantra C. Patel <141945075+Nihantra-Patel@users.noreply.github.com> --- erpnext/controllers/trends.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py index 7f07466b3bc..24d11e6050a 100644 --- a/erpnext/controllers/trends.py +++ b/erpnext/controllers/trends.py @@ -69,7 +69,7 @@ def get_data(filters, conditions): "Delivery Note", ]: posting_date = "t1.posting_date" - if filters.period_based_on: + if filters.period_based_on and conditions.get("trans") in ["Sales Invoice", "Purchase Invoice"]: posting_date = "t1." + filters.period_based_on if conditions["based_on_select"] in ["t1.project,", "t2.project,"]: @@ -224,7 +224,7 @@ def period_wise_columns_query(filters, trans): if trans in ["Purchase Receipt", "Delivery Note", "Purchase Invoice", "Sales Invoice"]: trans_date = "posting_date" - if filters.period_based_on: + if filters.period_based_on and trans in ["Purchase Invoice", "Sales Invoice"]: trans_date = filters.period_based_on else: trans_date = "transaction_date"