mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-13 17:53:49 +00:00
feat: option to exclude stand-alone returned sales invoices from the Gross Profit report
(cherry picked from commit 52cf9d4950)
This commit is contained in:
committed by
Mergify
parent
d920520843
commit
017dc792e6
@@ -85,6 +85,12 @@ frappe.query_reports["Gross Profit"] = {
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: "include_returned_invoices",
|
||||
label: __("Include Returned Invoices (Stand-alone)"),
|
||||
fieldtype: "Check",
|
||||
default: 1,
|
||||
},
|
||||
],
|
||||
tree: true,
|
||||
name_field: "parent",
|
||||
|
||||
@@ -859,7 +859,10 @@ class GrossProfitGenerator:
|
||||
if self.filters.to_date:
|
||||
conditions += " and posting_date <= %(to_date)s"
|
||||
|
||||
conditions += " and (is_return = 0 or (is_return=1 and return_against is null))"
|
||||
if self.filters.include_returned_invoices:
|
||||
conditions += " and (is_return = 0 or (is_return=1 and return_against is null))"
|
||||
else:
|
||||
conditions += " and is_return = 0"
|
||||
|
||||
if self.filters.item_group:
|
||||
conditions += f" and {get_item_group_condition(self.filters.item_group)}"
|
||||
|
||||
@@ -442,7 +442,11 @@ class TestGrossProfit(FrappeTestCase):
|
||||
sinv = sinv.save().submit()
|
||||
|
||||
filters = frappe._dict(
|
||||
company=self.company, from_date=nowdate(), to_date=nowdate(), group_by="Invoice"
|
||||
company=self.company,
|
||||
from_date=nowdate(),
|
||||
to_date=nowdate(),
|
||||
group_by="Invoice",
|
||||
include_returned_invoices=1,
|
||||
)
|
||||
|
||||
columns, data = execute(filters=filters)
|
||||
|
||||
Reference in New Issue
Block a user