Fixed #10811 -- Assigning unsaved objects to FK, O2O, and GFK raises ValueError

Thanks Aymeric Augustin for the initial patch and Loic Bistuer for the review.