In java controller, you can define the domain (filter) to apply on the grid view (possible to build a complex query condition in java). Better to build a filter with some conditions instead of return a list of id. If you return a list of id, if you refresh the grid, the controller is not called and the results will not update.
Hello @gdu-axelor
Thanks for clarification, I was trying to use domain and filtering
However this is my query
SELECT au.name,
CASE
WHEN ht.status_select=1 THEN ‘Draft’
WHEN ht.status_select=2 THEN ‘Waiting Validation’
WHEN ht.status_select=3 THEN ‘Validated’
WHEN ht.status_select=3 THEN ‘Refused’
END AS status_select,
ht.from_date, ht.to_date
FROM hr_employee he
INNER JOIN auth_user au ON au.employee = he.id
LEFT JOIN hr_timesheet ht ON au.id = ht.user_id
WHERE he.manager_user = :userId AND (current_date >= ht.from_date AND current_date <= ht.to_date)
AND ht.status_select < 5
union
SELECT au2.name, null, null, null
FROM hr_employee he2
INNER JOIN auth_user au2 ON au2.employee = he2.id
WHERE he2.manager_user = :userId AND au2.id not in (
SELECT au3.id
FROM hr_employee he3
INNER JOIN auth_user au3 ON au3.employee = he3.id
LEFT JOIN hr_timesheet ht2 ON au3.id = ht2.user_id
WHERE he3.manager_user = :userId AND (current_date >= ht2.from_date AND current_date <= ht2.to_date)
AND ht2.status_select < 5
)
ORDER BY name;
If possible could you post and example how you use domain filtering with a complex query.