(Java Minecraft 1.14) How to give effects in a function rewarded by an advancement?
A long search for the cause, a short and simple answer:
Functions that are rewards for an advancement triggered by the consume_item
trigger are executed before the item does what it does. For example your function first gives its effects to you, THEN the milk bucket clears all effects and the empty bucket it put into its slot.