fix: added project name in the purchase order analysis
This commit is contained in:
parent
0b040c7437
commit
c1f9997a67
@ -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",
|
||||
|
@ -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
|
||||
|
||||
@ -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,
|
||||
@ -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"):
|
||||
|
Loading…
Reference in New Issue
Block a user