mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-20 10:45:29 +00:00
fix: fixing Item-wise sales register
(cherry picked from commit c90185f533)
This commit is contained in:
@@ -376,8 +376,10 @@ def get_account_columns(invoice_list, include_payments):
|
|||||||
|
|
||||||
def get_invoices(filters, additional_query_columns):
|
def get_invoices(filters, additional_query_columns):
|
||||||
pi = frappe.qb.DocType("Purchase Invoice")
|
pi = frappe.qb.DocType("Purchase Invoice")
|
||||||
|
pii = frappe.qb.DocType("Purchase Invoice Item")
|
||||||
query = (
|
query = (
|
||||||
frappe.qb.from_(pi)
|
frappe.qb.from_(pi)
|
||||||
|
.left_join(pii).on(pi.name == pii.parent)
|
||||||
.select(
|
.select(
|
||||||
ConstantColumn("Purchase Invoice").as_("doctype"),
|
ConstantColumn("Purchase Invoice").as_("doctype"),
|
||||||
pi.name,
|
pi.name,
|
||||||
@@ -395,7 +397,7 @@ def get_invoices(filters, additional_query_columns):
|
|||||||
pi.outstanding_amount,
|
pi.outstanding_amount,
|
||||||
pi.mode_of_payment,
|
pi.mode_of_payment,
|
||||||
)
|
)
|
||||||
.where(pi.docstatus == 1)
|
.where((pi.docstatus == 1) & pii.item_code.isnotnull())
|
||||||
.orderby(pi.posting_date, pi.name, order=Order.desc)
|
.orderby(pi.posting_date, pi.name, order=Order.desc)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -414,8 +414,10 @@ def get_account_columns(invoice_list, include_payments):
|
|||||||
|
|
||||||
def get_invoices(filters, additional_query_columns):
|
def get_invoices(filters, additional_query_columns):
|
||||||
si = frappe.qb.DocType("Sales Invoice")
|
si = frappe.qb.DocType("Sales Invoice")
|
||||||
|
sii = frappe.qb.DocType("Sales Invoice Item")
|
||||||
query = (
|
query = (
|
||||||
frappe.qb.from_(si)
|
frappe.qb.from_(si)
|
||||||
|
.left_join(sii).on(si.name == sii.parent)
|
||||||
.select(
|
.select(
|
||||||
ConstantColumn("Sales Invoice").as_("doctype"),
|
ConstantColumn("Sales Invoice").as_("doctype"),
|
||||||
si.name,
|
si.name,
|
||||||
@@ -437,7 +439,7 @@ def get_invoices(filters, additional_query_columns):
|
|||||||
si.represents_company,
|
si.represents_company,
|
||||||
si.company,
|
si.company,
|
||||||
)
|
)
|
||||||
.where(si.docstatus == 1)
|
.where((si.docstatus == 1) & sii.item_code.isnotnull())
|
||||||
.orderby(si.posting_date, si.name, order=Order.desc)
|
.orderby(si.posting_date, si.name, order=Order.desc)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user