mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-16 05:15:10 +00:00
Merge pull request #46117 from Ninad1306/add_status_in_po_analysis_report
This commit is contained in:
@@ -19,6 +19,10 @@ frappe.query_reports["Purchase Order Analysis"] = {
|
||||
width: "80",
|
||||
reqd: 1,
|
||||
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
|
||||
on_change: (report) => {
|
||||
report.set_filter_value("name", []);
|
||||
report.refresh();
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: "to_date",
|
||||
@@ -27,6 +31,10 @@ frappe.query_reports["Purchase Order Analysis"] = {
|
||||
width: "80",
|
||||
reqd: 1,
|
||||
default: frappe.datetime.get_today(),
|
||||
on_change: (report) => {
|
||||
report.set_filter_value("name", []);
|
||||
report.refresh();
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: "project",
|
||||
@@ -38,13 +46,17 @@ frappe.query_reports["Purchase Order Analysis"] = {
|
||||
{
|
||||
fieldname: "name",
|
||||
label: __("Purchase Order"),
|
||||
fieldtype: "Link",
|
||||
fieldtype: "MultiSelectList",
|
||||
width: "80",
|
||||
options: "Purchase Order",
|
||||
get_query: () => {
|
||||
return {
|
||||
filters: { docstatus: 1 },
|
||||
};
|
||||
get_data: function (txt) {
|
||||
let filters = { docstatus: 1 };
|
||||
|
||||
const from_date = frappe.query_report.get_filter_value("from_date");
|
||||
const to_date = frappe.query_report.get_filter_value("to_date");
|
||||
if (from_date && to_date) filters["transaction_date"] = ["between", [from_date, to_date]];
|
||||
|
||||
return frappe.db.get_link_options("Purchase Order", txt, filters);
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -52,9 +64,16 @@ frappe.query_reports["Purchase Order Analysis"] = {
|
||||
label: __("Status"),
|
||||
fieldtype: "MultiSelectList",
|
||||
width: "80",
|
||||
options: ["To Pay", "To Bill", "To Receive", "To Receive and Bill", "Completed"],
|
||||
options: ["To Pay", "To Bill", "To Receive", "To Receive and Bill", "Completed", "Closed"],
|
||||
get_data: function (txt) {
|
||||
let status = ["To Pay", "To Bill", "To Receive", "To Receive and Bill", "Completed"];
|
||||
let status = [
|
||||
"To Pay",
|
||||
"To Bill",
|
||||
"To Receive",
|
||||
"To Receive and Bill",
|
||||
"Completed",
|
||||
"Closed",
|
||||
];
|
||||
let options = [];
|
||||
for (let option of status) {
|
||||
options.push({
|
||||
|
||||
@@ -70,14 +70,16 @@ def get_data(filters):
|
||||
po.company,
|
||||
po_item.name,
|
||||
)
|
||||
.where((po_item.parent == po.name) & (po.status.notin(("Stopped", "Closed"))) & (po.docstatus == 1))
|
||||
.where((po_item.parent == po.name) & (po.status.notin(("Stopped", "On Hold"))) & (po.docstatus == 1))
|
||||
.groupby(po_item.name)
|
||||
.orderby(po.transaction_date)
|
||||
)
|
||||
|
||||
for field in ("company", "name"):
|
||||
if filters.get(field):
|
||||
query = query.where(po[field] == filters.get(field))
|
||||
if filters.get("company"):
|
||||
query = query.where(po.company == filters.get("company"))
|
||||
|
||||
if filters.get("name"):
|
||||
query = query.where(po.name.isin(filters.get("name")))
|
||||
|
||||
if filters.get("from_date") and filters.get("to_date"):
|
||||
query = query.where(po.transaction_date.between(filters.get("from_date"), filters.get("to_date")))
|
||||
|
||||
@@ -19,6 +19,10 @@ frappe.query_reports["Sales Order Analysis"] = {
|
||||
width: "80",
|
||||
reqd: 1,
|
||||
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
|
||||
on_change: (report) => {
|
||||
report.set_filter_value("sales_order", []);
|
||||
report.refresh();
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: "to_date",
|
||||
@@ -27,6 +31,10 @@ frappe.query_reports["Sales Order Analysis"] = {
|
||||
width: "80",
|
||||
reqd: 1,
|
||||
default: frappe.datetime.get_today(),
|
||||
on_change: (report) => {
|
||||
report.set_filter_value("sales_order", []);
|
||||
report.refresh();
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldname: "sales_order",
|
||||
@@ -35,12 +43,13 @@ frappe.query_reports["Sales Order Analysis"] = {
|
||||
width: "80",
|
||||
options: "Sales Order",
|
||||
get_data: function (txt) {
|
||||
return frappe.db.get_link_options("Sales Order", txt);
|
||||
},
|
||||
get_query: () => {
|
||||
return {
|
||||
filters: { docstatus: 1 },
|
||||
};
|
||||
let filters = { docstatus: 1 };
|
||||
|
||||
const from_date = frappe.query_report.get_filter_value("from_date");
|
||||
const to_date = frappe.query_report.get_filter_value("to_date");
|
||||
if (from_date && to_date) filters["transaction_date"] = ["between", [from_date, to_date]];
|
||||
|
||||
return frappe.db.get_link_options("Sales Order", txt, filters);
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -53,10 +62,17 @@ frappe.query_reports["Sales Order Analysis"] = {
|
||||
fieldname: "status",
|
||||
label: __("Status"),
|
||||
fieldtype: "MultiSelectList",
|
||||
options: ["To Pay", "To Bill", "To Deliver", "To Deliver and Bill", "Completed"],
|
||||
options: ["To Pay", "To Bill", "To Deliver", "To Deliver and Bill", "Completed", "Closed"],
|
||||
width: "80",
|
||||
get_data: function (txt) {
|
||||
let status = ["To Pay", "To Bill", "To Deliver", "To Deliver and Bill", "Completed"];
|
||||
let status = [
|
||||
"To Pay",
|
||||
"To Bill",
|
||||
"To Deliver",
|
||||
"To Deliver and Bill",
|
||||
"Completed",
|
||||
"Closed",
|
||||
];
|
||||
let options = [];
|
||||
for (let option of status) {
|
||||
options.push({
|
||||
|
||||
@@ -86,7 +86,7 @@ def get_data(conditions, filters):
|
||||
ON sii.so_detail = soi.name and sii.docstatus = 1
|
||||
WHERE
|
||||
soi.parent = so.name
|
||||
and so.status not in ('Stopped', 'Closed', 'On Hold')
|
||||
and so.status not in ('Stopped', 'On Hold')
|
||||
and so.docstatus = 1
|
||||
{conditions}
|
||||
GROUP BY soi.name
|
||||
|
||||
Reference in New Issue
Block a user