Default filter for reports

Hi!, I would like to create a filter that retrieves records whose dates are in the past or present date,
i.e i want to be only able to retrieve and view documents in which a particular date field falls between today and the past. so documents with future dates will not be included in the results.
i have tried adding the dump_report_map included in the doc which returns a dictionary that includes the conditions, and columns to be returned,
but it still does not filter the results on the report builder page,How can i achieve this ?? Please assistance from ANYONE would be highly appreciated

Is it not possible to click on the Doctype, say, Purchase Order , click Reports , upper left, then Add Filter ? Something like this for dates before today.

Thanks @smino , But you added a filter for that to work, i would like it to be the default practice of generating all reports of this doctype, i am currently creating a custom script report but i want extend that functionality to all reports of the doctype

You can set up the search criteria, then click Menu , Save As to give it a unique name, then click Menu, Add to Desktop , reload to clear cache and the report is available there with one click… Would that work?


Thanks @smino , but setting up the search criteria involves setting the date filter to today, this achieves the result but it will require constant changing of the date filter to capture today’s date anytime the report is required.

UPDATE: so i have identified a method where by i can modify the default result set of a doctype for reports by using the prepare_filter_condition method in file in which i pass a list of filters in [fieldname,operator,value] format , the returned unicode object is then appended to a list and passed as the “filters” argument in the execute method of the DatabaseQuery object,
My question now is how i can implement this to work for only a particular doctype without editing frappe code. (i.e by adding it to a custom script)
Please any assistance will be highly appreciated.

Maybe for more clarity. We have the following scenario:

  1. A request for quotation has been raised with deadline 20/06/2019. This means that the submitted quotations should not be able to be viewed till the deadline elapses.
  2. Suppliers have responded with quotations
  3. We have blocked the ability of users of the system to view supplier quotations linked to an RFQ for which the deadline is greater than the current date either from the list or detail view
  4. We want to also be able to automatically exclude the same quotations from being selected in any reports until the date of the linked RFQ elapses.

The question is, what can we do so that whenever a report is run that references Quotation doctype, the returned quotations are filtered before display to exclude all quotations that reference RFQs where the deadline is > today’s date

@Ebuka_Joseph_Akeru does that explain it clearly?

Adding this link, to see if it can help:

IN the Query Report example, you would use ‘tabRequest for Quotation’.creation etc. and condition >= to curdate(). Perhaps easier to implement than Script Report

1 Like

Thanks for your help @smino , but it seems you don’t understand me, i want frappe’s report builder to omit all supplier quotations whose transaction dates are a future date without me having to create custom reports, so as soon as i open the report builder for Supplier Quotation, only those reports are returned.