mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
fix: fixed the query for sales invoice in sale partner related reports
This commit is contained in:
@@ -106,4 +106,7 @@ def get_conditions(filters, date_field):
|
|||||||
if filters.get("to_date"):
|
if filters.get("to_date"):
|
||||||
conditions += f" and {date_field} <= %(to_date)s"
|
conditions += f" and {date_field} <= %(to_date)s"
|
||||||
|
|
||||||
|
if filters.get("doctype") == "Sales Invoice":
|
||||||
|
conditions += " and not (is_consolidated = 1 and is_created_using_pos = 0)"
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|||||||
@@ -248,6 +248,9 @@ def get_actual_data(filters, sales_users_or_territory_data, date_field, sales_fi
|
|||||||
net_amount = child_doc.base_net_amount
|
net_amount = child_doc.base_net_amount
|
||||||
sales_field_col = parent_doc[sales_field]
|
sales_field_col = parent_doc[sales_field]
|
||||||
|
|
||||||
|
if filters.get("doctype") == "Sales Invoice":
|
||||||
|
query = query.where(~((parent_doc.is_consolidated == 0) & (parent_doc.is_created_using_pos == 1)))
|
||||||
|
|
||||||
query = query.select(
|
query = query.select(
|
||||||
child_doc.item_group,
|
child_doc.item_group,
|
||||||
parent_doc[date_field],
|
parent_doc[date_field],
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ def get_conditions(filters, date_field):
|
|||||||
if filters.get("brand"):
|
if filters.get("brand"):
|
||||||
conditions += " and dt_item.brand = %(brand)s"
|
conditions += " and dt_item.brand = %(brand)s"
|
||||||
|
|
||||||
|
if filters.get("doctype") == "Sales Invoice":
|
||||||
|
conditions += " and not (is_consolidated = 1 and is_created_using_pos = 0)"
|
||||||
|
|
||||||
if filters.get("item_group"):
|
if filters.get("item_group"):
|
||||||
lft, rgt = frappe.get_cached_value("Item Group", filters.get("item_group"), ["lft", "rgt"])
|
lft, rgt = frappe.get_cached_value("Item Group", filters.get("item_group"), ["lft", "rgt"])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user