Reporting date - passing date to search in list-view

I’d like to continue working on “association” module, which is stuck amongst others due to issues defining the “is member” state.

Whether a party “is member” depends on the (workflow) state at some reporting date. E.g.

  • Jane Doe becomes a member as of today and already gave notice of termination of her membership to the end of the year.
  • When looking at the member list as of today, Jane “is_member == True”
  • When looking at the member list as of one week ago, Jane is_member == False"
  • When looking forward on the member list of next year (like: Who will be member next year), Jane ought to be shows as “is_member == False” (subject to further refinement)

Implementing a method is_member_as_of_date(reporting_date) is easy. But:

How can I implement passing some date to this function in a list-view? Any example into this direction?

You can activate the _history on your model. Any change of the record will then be recorded. After this you can see the history by activating the View Logs… in the tools menu.

When you want to see the historical data in the view, you may have a look at the product_cost_history module, which introduces a relate to Cost Price Revisions on products.

Using a date in the context.

Most of the reports do that with a contextual model containing a Date field.

Thank for the answers so far.

Historyzation of the model seems overdose for me. Anyhow this made me aware that I missed some points:

  • There will be fields “start_date” and “end_date” (names to be discussed) — these are required at least since these dates might differ from the date the change is recorded in Tryton.
  • We might not need a workflow and state at all — at least, the workflow state is not relevant for “is_member”, neither is the data of workflow state change. “is_member” depends on “start_date” and “end_date” only.

Is there an example in how to select the reporting date for a list-view? I found the examples shown below, anyhow would prefer to have a date-selection field to ease usage.


You would need to add a context_model to the list view’s window action. In the context_model you would define a date field, the value from this would then be available when calculating the is_member.
Some of the account reporting models are probably reasonable examples of this, such as the aged balance one.

1 Like

Many thanks. I found product_price_list_dates which (probably) has the functionality I’m seeking:


Wrote a tutorial: Creating filtered views with `context_domain` - e.g. reporting date

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.