A report Creation

I want to create a custom Query Report showing price trend report from the Price List Doctype. Here is the code but it still brings me an error [KeyError: ‘valid_from’]

tSELECT 
    ip.name AS "ID",
    ip.item_name AS "Item Name",
    ip.item_code AS "Item Code",
    ip.price_list AS "Price List",
    ip.price_list_rate AS "Rate",
    ip.valid_from AS "Valid From",
    ip.valid_upto AS "Valid Upto",
    ip.currency AS "Currency"
FROM 
    `tabItem Price` ip
WHERE 
    ip.item_code = %(item_code)s
    AND ip.valid_from >= %(valid_from)s
    AND (ip.valid_upto IS NULL OR ip.valid_upto <= %(valid_upto)s)
ORDER BY 
    ip.valid_from ASC;

IMO, this error is from Python. If you share your Python code, then maybe I or someone from the community can help you.

1 Like

@nik1 assign default value for valid_from and valid_to in filters