Don't see why that would have worked with two portals in version 6.
There's code (go to field) to put the focus on the portal into which you paste data, but no code to put the same focus into a particular portal row of the portal from which you are copying data.
and since your focus has to switch back and forth between portal's in this script, go to portal row next won't work, you'll need a counter--in variable or a global field to keep track of what portal row you next need to copy from and you'll need to increment that counter each time.
There are many alternative methods for copying data from one table to another. Import records can do this all in one script step, followed by a replace field contents operation to update the needed key field so that the new line items match to the correct invoice record. Another option is to pull up a found set of the portal records on a layout based on that table, then loop through them, switching over to a third layout based on the second portal in order to create a new record with this data.
And you need to get rid of the copy/paste script steps. They silently fail if the field is not present on the current layout, but more importantly, they destroy any data the user may have previously copied to the clipboard before running this script. This can easily be avoided by using set variable to copy data and set field with a reference to the variable to paste the data. (back in version 6, we used set field to set a global field as a way to copy without affecting clipboard data.)