I checked and everything is copied, when I clicked the button Add line item on the Invoices detail layout for the all products popover still saying in the sort order portal record table missing, but the item field is there.

If you copy items in the wrong order, such as you copy the portal before you copy the table or before you setup the table occurrence the portal is based on then FM will show table missing. As Steve stated you will have to manually repair by selecting the correct table / table occurrence. You can go back to the original database to verify what the table / table occurrence should be.

What I did..I imported all the tables to my solution...to make it easier for me I used my laptop as I'm working on my desktop to map the relationships and to make sure that I dont miss anything...make all layouts...value lists..then copied all scripts..then copied all layouts.