I know you're still on probation now, but the more you wait before sounding the alarm, the worse it's going to end up for you. I pretty much guarantee it.
With that said, when approaching your boss with a problem, you should also have a set of potential solutions you can propose as well. If you don't have good solutions to propose, then your boss may try to come up with their own solution(s) on the spot and their solution(s) will either be incomplete or totally unrealistic.
So ask yourself, what could possibly work in a case like this? The guy is retiring. Your boss has little leverage over him. Can you start pair programming with him? If you're not in the same room, can you move your desk closer to him? If he likes chocolate, can you buy him a box of chocolate? If he likes sports, can you learn about sports so you have a common interest to chit-chat about? Or if the rest of your workload is too high, can you ask your boss to reduce it for a couple of months until this transition is complete?
Obviously, my own ideas are half-baked, but you get the idea. You need to brainstorm and think through a number of potential solutions yourself first.
And if there is any bad news to be delivered, it needs to be delivered now, not later. If you wait for things to get out of hand before you tell your boss what happened, your boss won't ever trust you again.
Additionally to that, they gave code execution permission to employees
who never coded in their life and don't know what they are doing when
they copy paste the scripts.
Interesting. Are those scripts under version control? If nothing is under version control, that's the first thing I would do. I would put everything under version control. What about tests? Could those scripts benefit from better automated testing? Or from being wired up to some monitoring software like Nagios?
Also, do not assume malicious intent. That person may just have a better relationship with those other people he gave execution access to. Or perhaps, he didn't want to be bothered, and simply gave it to them because it was the most expeditious thing to do.
Pair programming is the first thing I asked for. I wanted to make a
meeting where they show me how to just simply go about designing and
programming a simple query for this ERP system. However, the second
meeting they said they were not prepared and gave excuses that this is
not doable and everything is well documented.
This is very serious. Raise the alarm! Ask your manager to do pair programming with the two of you.
But prepare your manager in advance, if this guy comes up with the same excuses and says that everything is well documented, have your manager ask you to take over his keyboard and test you on the spot while the other guy is watching.
Tell your manager that he can blame you for being incompetent. In other words, tell your manager to be as hard on you as possible in front of this other guy, since he can't really apply pressure on him directly.
Then have your manager come back the next day and do the same thing again. Even if the guy promises to help you, he's probably not going to do it consistently. That's why your manager needs to make the commitment to follow up and do some pair programming with the two of you once a day or once every two days for the next 30 days.
In other words, you need to hash out a plan for your manager, and think things through carefully, just like if you were playing a chess game 6 moves in advance. Think things through, take some notes, and make sure your manager is fully prepared before he even tries to address this situation.
As for version control:
The scripts are stored as .txt on hdd and copy pasted into a shell of
the ERP program for execution. There is no version control, no tests
not anything modern software development would do.
Are there regular backups? If there are no backups, make your very backup at the very least, put it somewhere else, and label your zipped folder with backup_year_mm_dd
And come up with a longterm plan to progressively modernize the rest of these issues.