In its current implementation ( introduced in 4787eadd ), `variation_category` parameter of Inventory API require movements to be in the `predicate_category` table. The approach is to do a first query to get uids of all movements members of the variation and pass their `uid` to catalog. My guess is that this does not scale well. It also uses deprecated `where_expression` and generates invalid SQL when no movements match.
As far as I know, it is only used in [testInventory](https://lab.nexedi.com/nexedi/erp5/blob/ba541ad46e5c593f94fe1ebe79e99d67aafdecb1/product/ERP5/tests/testInventory.py#L1024). We could also consider dropping it, but keeping compatibility is easy.
This implementation just use `variation_text`.
[Test results](https://nexedi.erp5.net/test_result_module/20170502-1FDBAB66) are OK; there is one functional test failure but it really looks unrelated.
@yusei @vpelletier @seb @romain do you see problems with this ?