حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَعَلِيُّ بْنُ مُحَمَّدٍ، قَالاَ حَدَّثَنَا وَكِيعٌ، عَنْ هِشَامِ بْنِ عُرْوَةَ، عَنْ أَبِيهِ، عَنْ عَائِشَةَ، زَوْجِ النَّبِيِّ صلى الله عليه وسلم أَنَّ بَرِيرَةَ أَتَتْهَا وَهِيَ مُكَاتَبَةٌ قَدْ كَاتَبَهَا أَهْلُهَا عَلَى تِسْعِ أَوَاقٍ فَقَالَتْ لَهَا إِنْ شَاءَ أَهْلُكِ عَدَدْتُ لَهُمْ عَدَّةً وَاحِدَةً وَكَانَ الْوَلاَءُ لِي قَالَ فَأَتَتْ أَهْلَهَا فَذَكَرَتْ ذَلِكَ لَهُمْ فَأَبَوْا إِلاَّ أَنْ تَشْتَرِطَ الْوَلاَءَ لَهُمْ فَذَكَرَتْ عَائِشَةُ ذَلِكَ لِلنَّبِيِّ صلى الله عليه وسلم فَقَالَ ‏"‏ افْعَلِي ‏"‏ ‏.‏ قَالَتْ فَقَامَ النَّبِيُّ صلى الله عليه وسلم فَخَطَبَ النَّاسَ فَحَمِدَ اللَّهَ وَأَثْنَى عَلَيْهِ ثُمَّ قَالَ ‏"‏ مَا بَالُ رِجَالٍ يَشْتَرِطُونَ شُرُوطًا لَيْسَتْ فِي كِتَابِ اللَّهِ كُلُّ شَرْطٍ لَيْسَ فِي كِتَابِ اللَّهِ فَهُوَ بَاطِلٌ وَإِنْ كَانَ مِائَةَ شَرْطٍ كِتَابُ اللَّهِ أَحَقُّ وَشَرْطُ اللَّهِ أَوْثَقُ وَالْوَلاَءُ لِمَنْ أَعْتَقَ ‏"‏ ‏.‏

It was narrated from Hisham bin 'Urwah, from his father, about 'Aishah the wife of the Prophet (PBUH) - : that Barirah came to her when she was came to her when she was Muktabah, and her masters had written a contract of manumission for nine Uqiyyah. She (`Aishah) said: “If your masters wish I will pay them that in one sum, and the right of inheritance will belong to me.” He said: “So she went to her masters and told them about that, but they insisted that the right of inheritance should belong to them. `Aishah mentioned that to the Prophet (PBUH) and he said: 'Do it.' Then the Prophet (PBUH) stood up and addressed the people. He praised and glorified Allah (SWT), then he said: 'What is the matter with some people who stipulated conditions that are not in the Book of Allah (SWT)? Every conditions that is not in the Book of Allah (SWT) is invalid, even if there are one hundred conditions. The Book of Allah(SWT) is more deserving of being followed and the conditions of Allah (SWT) are more binding. And the Wala belongs to the one who manumits (the slave).” Translation Not Available

Book reference: Sunan Ibn Majah Book 19 Hadith 2521
Web reference: Sunan Ibn Majah Volume 3 Book 19 Hadith 2521