Skip to content

Commit

Permalink
Merge pull request #27701 from rohitwaghchaure/minor-added-project-na…
Browse files Browse the repository at this point in the history
…me-in-purchase-order-analysis

fix: added project name in the purchase order analysis
  • Loading branch information
rohitwaghchaure committed Sep 29, 2021
2 parents b39f8a6 + c1f9997 commit 104d107
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ frappe.query_reports["Purchase Order Analysis"] = {
"default": frappe.datetime.get_today()
},
{
"fieldname": "purchase_order",
"fieldname":"project",
"label": __("Project"),
"fieldtype": "Link",
"width": "80",
"options": "Project"
},
{
"fieldname": "name",
"label": __("Purchase Order"),
"fieldtype": "Link",
"width": "80",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ def get_conditions(filters):
if filters.get("from_date") and filters.get("to_date"):
conditions += " and po.transaction_date between %(from_date)s and %(to_date)s"

if filters.get("company"):
conditions += " and po.company = %(company)s"
for field in ['company', 'name', 'status']:
if filters.get(field):
conditions += f" and po.{field} = %({field})s"

if filters.get("purchase_order"):
conditions += " and po.name = %(purchase_order)s"

if filters.get("status"):
conditions += " and po.status in %(status)s"
if filters.get('project'):
conditions += " and poi.project = %(project)s"

return conditions

Expand All @@ -57,6 +55,7 @@ def get_data(conditions, filters):
SELECT
po.transaction_date as date,
poi.schedule_date as required_date,
poi.project,
po.name as purchase_order,
po.status, po.supplier, poi.item_code,
poi.qty, poi.received_qty,
Expand Down Expand Up @@ -175,6 +174,12 @@ def get_columns(filters):
"fieldtype": "Link",
"options": "Supplier",
"width": 130
},{
"label": _("Project"),
"fieldname": "project",
"fieldtype": "Link",
"options": "Project",
"width": 130
}]

if not filters.get("group_by_po"):
Expand Down

0 comments on commit 104d107

Please sign in to comment.