[IMP] hr: needaction, subtypes and department-based improvements

Hello, 

use loop instead of browse only one element.
here ids is a list of department id. so should use loop to browse record of dapartments.

Thanks