Hi Muhammad Kamil,
Compute function has already that functionality. You need to pass the date with context and called the compute method from the currency model.Please try with this code.
convert_currency = currency.with_context(date= your invoice date).compute(amount, SAR)
This will find the currency rate <= to your invoice date.
Hope it will help you
Please Vote for the Answer if works.