How to monitor stock level at startup? F'up

Inspired by this thread, I tried the idea to put this:
[['product.categories_all', '=', 'my-product-category-name' ]]
into the search criteria field of a window action

It works for me, but instead of ‘my-product-category-name’, this string ‘=my-product-category-name’ (with an additional ‘=’) is put into the search line. What could be wrong in my search criteria entry - or whatever?

EG

It is normal, this is the syntax of the search widget for an = operation.

Thank you, Sir, for your quick reply.

So I tried
[['product.categories_all', 'ilike', 'my-product-category-name' ]]
in search criteria instead, because I suspect we might deal with text fields here, but get the same result:
Again, there is an “=” in front of the my-product-category-name string in the search line.

Can I avoid this?

EG

This is because without any wildcard like % or _, it is mainly equivalent to a = operator (minus the case insensitive but we do not have such operator in the search widget).

Sorry for coming back on this, seems I’m still not asking the right questions…

So - here is what is in actions > window actions > products by location - ‘my-search-string’ is replaced by the real search string:

And this appears an the target window “products location”

As you see - “my-search-string” has got an ‘=’ in front of it, and I could not yet find out how to get rid of it.

2nd: In “domain”, the ‘forecast quantity’ string needs to be replaced by “nothing” (“find anything without restriction”) But leaving the field empty does not work. How can I achieve “find anything”?

EG

The domain is set to use = operator so it translated like that in the search widget (as expected).

I do not understand.

Yes. But how can I change that? - I need it to search for the string without the ‘=’.

I need to see all of my stock positions, especially those where stock level fell to zero.

This search for the string without the operator. See the documentation.

See Usage — Tryton module for stock and inventory

Right. I’m giving in here.
I tried my best, but it seems I cannot make myself understood, and I cannot understand your answers, they seem to be designed for programmers. Unluckily, I’m just an ordinary user.

Thank you, Sir, for your effort. Much appreciated anyway.

Hi @Eulengesicht,
The ‘=’ in front of your search string is not an issue:

If your results are not the ones you expect, the problem is probably on other fields.
Hope it helps.

Thank you for your message.
Hm, not sure. If the search string has got the “=” at the beginning, only 3 products are shown. When I do remove the “=”, I get the complete result. So I think, in my case it matters.

I cannot find out what these 3 products have in common - but I guess the proper solution would be a search string without an “=”.

Thanks for taking part,
EG

It is hard to understand your case without visual examples, but if the ‘=’ operator is giving you 3 records, it is because only this 3 records are literally equal to your search, anyways, I see you’ve tried with:
[['product.categories_all', 'ilike', 'my-product-category-name']]
Even you’ve changed the ‘=’ to ‘ilike’, as Ced already said, you did not use any wildcard, so it is basically the same, you should try with something like:
[['product.categories_all', 'ilike', '%my-product-category-name%']]
So it does take effect; i just did this on the demo:


and this is the result:

btw, leaving the domain empty does actually “find anything” as long as it match the search, make sure you properly reload after modifying the action.
Let me know what do you get.

Great you’re taking care, much appreciated.

To do proper testing - how can I manually trigger the window action? - By now, I’m switching to another language, but I don’t think that delivers the results desired.

EG

Sorry I don’t understand

Is there any other way to trigger the action than manually?

I don’t know what do you mean by this.

I put it into menu > administration > user > actions tab, so it’s triggered at tryton client launch.

But I dont know how to trigger this window action manually.

You need to open Inventory & stock > locations then select a location and the ‘Products’ action on the related records:


it its explained here:

Is that what you asked?

Ah, thank you. I should have known that on my own, sorry for the question.

On the main issue:
I now put [['product.categories_all', 'ilike', '%my-search-string'] into the search criteria box. But that does not make any difference:

In the window action result window, I get Artikel.Artikelkategorien: =my-search-string. So for me it appears that the “=” always is included into the search string and for that reason produces a wrong result.

NB: No dfference as well with %my-search-string or %my-search-string%.

Have you properly reloaded the client after modifying the action? i’ve never used desktop client but in the demo after modifying the search value I need to refresh or it still gets the value from before.
ps: test %my-search-string% isntead of %my-search-string as you don’t know where the problem exactly is.

I did all kinds: Relaunch client, restart server - and now carry out the window action manually. No difference. Always the “=” is included in the search string.

Yes, I did so.

Then is impossible to help, I reproduced everything I said in the demo, I honestly recomend you to also try on demo as it is a clean environment then once you got the steps clear try on your server.

1 Like