Parameters use on BaBI

Hello everyone, I am using the BaBI module which is very very useful. I am trying to make a report with a “dynamic” filter. I understand that this is the use of the parameters. I defined one for my report, but I can’t make it work. I don’t know how to “call it” from the domain or from the expression.
I will appreciate your help.
Thank you!

Hello, Jeronimo,
here’s a sample dynamic filter:

Hope it helps!

Thank you very much @albert! It worked perfect!
And congratulations for you work at this module, it’s very useful for the non programing users!
Maybe adding Parameters on the Domain or Expression tooltip would help:
And I have another question: “Name” it’s a translatable field. What happens if I change the translate just for one language? I have no that problem at the moment but I think it’s better to use a “name” as a no translatable field and another as “Description” as a translatable field. Maybe I’m wrong. It’s just a suggestion.

The behaviour is not specific to babi. Usually you’ll get the name given in another language.

Note that the name is used for the user to understand what the filter is about, so we have to make it translatable so she understands it. You can create modules (such as babi_reports_sale, for example) which provide some expressions, so making it translatable allows the module to be useful for users using different languages.

Hi @albert, I was trying to make a dynamic filter of the states of a invoice for example. Looking at the availible options on BaBI I thought in 4 booleans and a lot of if’s but, first of all, I don’t know how to write it. In the second term, what I need it’s something as a selection combo. Is it possible?
The perfect example it’s the tree view search filter were you choose one or more states.

About the old cuestion, I understand perfectly the reasons and usage of the translation feature, it’s very useful. But in the fact party (Tercero, Party, etc.) it’s a translatable field I always use it as wich is the technichal name. I don’t use o.tercero

Just my two cents.

A post was split to a new topic: Execute BaBI report on click

Filters have not been designed to do that. However, I see several possibilities:

  • Domains are PYSON expressions so you may be able to use a PYSON expression such as “If({PARAMETER}, [(‘state’, ‘=’, ‘posted’)], )”. Note I have never tested this so I’m not sure it’s going to work.
  • Create fields.Function(fields.Boolean()) with a searcher that allow you to create a simple expression such as [(‘state_posted’, ‘=’, {PARAMETER})]

Well, you must use the technical name. “o.tercero” would not work at all.

1 Like

I could make it work, the filter selects by the parameter. Now I have the problem that the boolean is always required (required as True). So it makes no sense to use it. How can I solve it? Thanks!

A patch is needed to babi, to not make boolean filter fields required.