Merge pull request #27701 from rohitwaghchaure/minor-added-project-name-in-purchase-order-analysis

fix: added project name in the purchase order analysis
This commit is contained in:
rohitwaghchaure 2021-09-29 23:41:31 +05:30 committed by GitHub
commit 104d107659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 8 deletions

View File

@ -30,7 +30,14 @@ frappe.query_reports["Purchase Order Analysis"] = {
"default": frappe.datetime.get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname": "purchase_order", "fieldname":"project",
"label": __("Project"),
"fieldtype": "Link",
"width": "80",
"options": "Project"
},
{
"fieldname": "name",
"label": __("Purchase Order"), "label": __("Purchase Order"),
"fieldtype": "Link", "fieldtype": "Link",
"width": "80", "width": "80",

View File

@ -41,14 +41,12 @@ def get_conditions(filters):
if filters.get("from_date") and filters.get("to_date"): if filters.get("from_date") and filters.get("to_date"):
conditions += " and po.transaction_date between %(from_date)s and %(to_date)s" conditions += " and po.transaction_date between %(from_date)s and %(to_date)s"
if filters.get("company"): for field in ['company', 'name', 'status']:
conditions += " and po.company = %(company)s" if filters.get(field):
conditions += f" and po.{field} = %({field})s"
if filters.get("purchase_order"): if filters.get('project'):
conditions += " and po.name = %(purchase_order)s" conditions += " and poi.project = %(project)s"
if filters.get("status"):
conditions += " and po.status in %(status)s"
return conditions return conditions
@ -57,6 +55,7 @@ def get_data(conditions, filters):
SELECT SELECT
po.transaction_date as date, po.transaction_date as date,
poi.schedule_date as required_date, poi.schedule_date as required_date,
poi.project,
po.name as purchase_order, po.name as purchase_order,
po.status, po.supplier, poi.item_code, po.status, po.supplier, poi.item_code,
poi.qty, poi.received_qty, poi.qty, poi.received_qty,
@ -175,6 +174,12 @@ def get_columns(filters):
"fieldtype": "Link", "fieldtype": "Link",
"options": "Supplier", "options": "Supplier",
"width": 130 "width": 130
},{
"label": _("Project"),
"fieldname": "project",
"fieldtype": "Link",
"options": "Project",
"width": 130
}] }]
if not filters.get("group_by_po"): if not filters.get("group_by_po"):