In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
In his response to your question, Sheikh Muhammad Salih Al-Munajjid, a prominent Saudi Muslim lecturer and author, states:
Yes, that is permissible. Ibn Taymiyyah said:
“It is not permissible to make a will leaving something to an heir without the consent of the other heirs. Heirs may be included in the will in general terms without mentioning them by name.” (Al-Ikhtiyarat, p. 190)
What this means is that if a will is in general terms, i.e., it does not mention people by name, such as one that mentions categories, such as the poor, or students, etc., it is permissible for those who fall into those categories to take something from this bequest even if they are also heirs. But if the will mentions people by name, such as bequeathing wealth to relatives, the heirs cannot be included in this bequest.
Almighty Allah knows best.