mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 03:09:09 +00:00
fix: project value is missing from procurement-tracker (#23549)
Co-authored-by: Marica <maricadsouza221197@gmail.com>
This commit is contained in:
@@ -143,7 +143,7 @@ def get_conditions(filters):
|
|||||||
conditions = ""
|
conditions = ""
|
||||||
|
|
||||||
if filters.get("company"):
|
if filters.get("company"):
|
||||||
conditions += " AND par.company=%s" % frappe.db.escape(filters.get('company'))
|
conditions += " AND parent.company=%s" % frappe.db.escape(filters.get('company'))
|
||||||
|
|
||||||
if filters.get("cost_center") or filters.get("project"):
|
if filters.get("cost_center") or filters.get("project"):
|
||||||
conditions += """
|
conditions += """
|
||||||
@@ -151,10 +151,10 @@ def get_conditions(filters):
|
|||||||
""" % (frappe.db.escape(filters.get('cost_center')), frappe.db.escape(filters.get('project')))
|
""" % (frappe.db.escape(filters.get('cost_center')), frappe.db.escape(filters.get('project')))
|
||||||
|
|
||||||
if filters.get("from_date"):
|
if filters.get("from_date"):
|
||||||
conditions += " AND par.transaction_date>='%s'" % filters.get('from_date')
|
conditions += " AND parent.transaction_date>='%s'" % filters.get('from_date')
|
||||||
|
|
||||||
if filters.get("to_date"):
|
if filters.get("to_date"):
|
||||||
conditions += " AND par.transaction_date<='%s'" % filters.get('to_date')
|
conditions += " AND parent.transaction_date<='%s'" % filters.get('to_date')
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
def get_data(filters):
|
def get_data(filters):
|
||||||
@@ -198,21 +198,23 @@ def get_mapped_mr_details(conditions):
|
|||||||
mr_records = {}
|
mr_records = {}
|
||||||
mr_details = frappe.db.sql("""
|
mr_details = frappe.db.sql("""
|
||||||
SELECT
|
SELECT
|
||||||
par.transaction_date,
|
parent.transaction_date,
|
||||||
par.per_ordered,
|
parent.per_ordered,
|
||||||
par.owner,
|
parent.owner,
|
||||||
child.name,
|
child.name,
|
||||||
child.parent,
|
child.parent,
|
||||||
child.amount,
|
child.amount,
|
||||||
child.qty,
|
child.qty,
|
||||||
child.item_code,
|
child.item_code,
|
||||||
child.uom,
|
child.uom,
|
||||||
par.status
|
parent.status,
|
||||||
FROM `tabMaterial Request` par, `tabMaterial Request Item` child
|
child.project,
|
||||||
|
child.cost_center
|
||||||
|
FROM `tabMaterial Request` parent, `tabMaterial Request Item` child
|
||||||
WHERE
|
WHERE
|
||||||
par.per_ordered>=0
|
parent.per_ordered>=0
|
||||||
AND par.name=child.parent
|
AND parent.name=child.parent
|
||||||
AND par.docstatus=1
|
AND parent.docstatus=1
|
||||||
{conditions}
|
{conditions}
|
||||||
""".format(conditions=conditions), as_dict=1) #nosec
|
""".format(conditions=conditions), as_dict=1) #nosec
|
||||||
|
|
||||||
@@ -232,7 +234,9 @@ def get_mapped_mr_details(conditions):
|
|||||||
status=record.status,
|
status=record.status,
|
||||||
actual_cost=0,
|
actual_cost=0,
|
||||||
purchase_order_amt=0,
|
purchase_order_amt=0,
|
||||||
purchase_order_amt_in_company_currency=0
|
purchase_order_amt_in_company_currency=0,
|
||||||
|
project = record.project,
|
||||||
|
cost_center = record.cost_center
|
||||||
)
|
)
|
||||||
procurement_record_against_mr.append(procurement_record_details)
|
procurement_record_against_mr.append(procurement_record_details)
|
||||||
return mr_records, procurement_record_against_mr
|
return mr_records, procurement_record_against_mr
|
||||||
@@ -280,16 +284,16 @@ def get_po_entries(conditions):
|
|||||||
child.amount,
|
child.amount,
|
||||||
child.base_amount,
|
child.base_amount,
|
||||||
child.schedule_date,
|
child.schedule_date,
|
||||||
par.transaction_date,
|
parent.transaction_date,
|
||||||
par.supplier,
|
parent.supplier,
|
||||||
par.status,
|
parent.status,
|
||||||
par.owner
|
parent.owner
|
||||||
FROM `tabPurchase Order` par, `tabPurchase Order Item` child
|
FROM `tabPurchase Order` parent, `tabPurchase Order Item` child
|
||||||
WHERE
|
WHERE
|
||||||
par.docstatus = 1
|
parent.docstatus = 1
|
||||||
AND par.name = child.parent
|
AND parent.name = child.parent
|
||||||
AND par.status not in ("Closed","Completed","Cancelled")
|
AND parent.status not in ("Closed","Completed","Cancelled")
|
||||||
{conditions}
|
{conditions}
|
||||||
GROUP BY
|
GROUP BY
|
||||||
par.name, child.item_code
|
parent.name, child.item_code
|
||||||
""".format(conditions=conditions), as_dict=1) #nosec
|
""".format(conditions=conditions), as_dict=1) #nosec
|
||||||
Reference in New Issue
Block a user