Praise be to Allah.
This hadith was mentioned by al-Ghazaali in Ihya’ ‘Uloom ad-Deen (1/200), and by Abu Taalib al-Makki in Qoot al-Quloob. Al-Haafiz al-‘Iraaqi said concerning it in his Takhreej:
It was narrated by Abu Moosa al-Madeeni and by Abu Mansoor ad-Daylami in Musnad al-Firdaws with a very weak (da‘eef jiddan) isnaad, and it is odd (munkar).
It was also narrated by ash-Shawkaani in al-Fawaa’id al-Majmoo‘ah fi’l-Ahaadeeth al-Mawdoo‘ah (p. 46) and by al-Laknawi in al-Aathaar al-Marfoo‘ah fi’l-Akhbaar al-Mawdoo‘ah (1/54).
With regard to doing righteous deeds and dedicating the reward thereof to the dead, whether one’s parents or others, the scholars differed as to whether that is permissible. The view that is most likely to be correct is that nothing of that reaches the deceased except that which is mentioned in the hadith texts only, such as Hajj, ‘Umrah, charity, and fasting on behalf of one who died still owing obligatory fasts. But better than all of that is offering supplication for them.
For a more detailed discussion of that, please see the answers to questions no. 46698 and 763 .
So the Muslim should be keen to act in accordance with what was soundly narrated from the Prophet (blessings and peace of Allah be upon him), for that is sufficient, and he should beware of weak (da‘eef) and fabricated (mawdoo‘) hadiths.
We ask Allah, may He be exalted, to grant us understanding of our religion.
And Allah knows best.