Keep same id for invoices, credit memos…

Hello I would like to aask why you decided to not maintain same ID for:

  • Products
  • Invoices
  • Credit memos
  • Shippings
  • Customers

Maybe you decided to improve some importing but, can you explain us this decision? It’s important for us to keep same id for

  • Products
  • Invoices
  • Credit Memos
  • Shippings

I already changed Step5 to keep same product ID but I don’t know well how to do this with the rest. Can you please tell us how to keep same Id for this things?

15 answers

Profile photo of ubdev Staff 98390.00 $tone July 29, 2017
Public

Hi Sergio B, 
It’s true that the IDs are auto-incremental. We use this approach that aims at allowing to migrate data from M1 to M2 with existing of data (customers, sales orders…).
If you want to keep the same IDs as you mentioned, we’re afraid it will need customization for your specific case. If this is what you will consider, we will provide you the estimated quote upon your confirmation. 
Regards,
Ubertheme team
 

#1
Profile photo of Sergio B 340.00 $tone July 30, 2017
Public

I’m still having the same question, why your script does not save the same incremental ID for all ? You already posted how to maintain same product id, why not the rest ? Do you mean Magento 2 with already data?
As you should know, you cannot have different invoices with different IDs, this can be give law troubles.

#2
Profile photo of ubdev Staff 98390.00 $tone July 31, 2017
Public

Hi Sergio B,
We’d like to clarify a little bit further about the auto-incremental IDs. 
If our migration tool keeps the original IDs of objects in M1, then it causes conflict with the M2 instance with existing data. Hence, auto-incremental IDs is the solution to solve such issue. 
If you want to keep all M1 IDs the same and port to M2 on as-is basis, it will need additional customization for our tool to meet your need, as mentioned in our previous reply. Also it is mandatory that your M2 must be a fresh instance.
Regards,
Ubertheme team

#3
Profile photo of Sergio B 340.00 $tone July 31, 2017
Public

If our migration tool keeps the original IDs of objects in M1, then it causes conflict with the M2 instance with existing data.

Oh OK the thing is our Magento 2 instance WAS (before migrating data with your tool) completely a new fresh install, as you instruct in the readme file
 

 
So why your code is prepared for non-new fresh installs ? I think this is not a customization, what you propose it gives me to think badly

#4
Profile photo of ubdev Staff 98390.00 $tone July 31, 2017
Public

Hi Sergio B, 
We see your concern. Our tool uses a single codebase which is applicable for both fresh instance and instance with existing data. So the auto-incremental is default for all cases. That’s why we refer to the customisation for the tool to keep original IDs as you wish. 
Further, the fresh instance is to refer to our recommendation that users should focus on the data migration as the first priority task, rather than integrating 3rd extensions or customisation before migrating data which might lead to unexpected conflict. 
Regards,
Ubertheme team

#5
Profile photo of Sergio B 340.00 $tone July 31, 2017
Public

Our tool uses a single codebase which is applicable for both fresh instance and instance with existing data

OK fine so can you bring me the customizations so I can apply them? I can give you access to our repo too.
 

How do I keep product ID the same ?


 
We already followed this guide and works, but this is only for product id. 

#6
Profile photo of Mall Staff 184060.00 $tone August 1, 2017
Public

Hi there,

OK fine so can you bring me the customizations so I can apply them? I can give you access to our repo too.

We’d like to re-confirm that to keep original IDs, your Magento 2 must be a fresh instance.
Also, please let us know which objects you want to keep ID, so that we could provide you estimated quote for the customization.
Regards,
Mall.

#7
Profile photo of Sergio B 340.00 $tone August 1, 2017
Public
  • Invoices
  • Credit memos

It’s basic, because you cannot have two invoices and credit memos with the same ID, it’s illegal. So when you declare those invoices, then Tax Agency can inspect this.

#8
Profile photo of Mall Staff 184060.00 $tone August 1, 2017
Public

Hi Sergio B,
We will send you an email shortly regarding the original IDs. 
For the tweak to keep IDs of Invoices and Credit Memos, you can follow steps below: 

  • Invoices

To keep M1’s invoices IDs you could do the following steps:
-- Open the php file at: pub/ub-tool/protected/controllers/Step7Controller.php
and find the line:

$salesInvoice2->entity_id = null;

and replace it with:

//$salesInvoice2->entity_id = null;
  • Credit memos

To keep M1’s credit memos IDs:
-- Open the php file at: pub/ub-tool/protected/controllers/Step7Controller.php
and find the line:

$salesCredit2->entity_id = null;

and replace it with:

//$salesCredit2->entity_id = null;

Once done, you make sure that, your Magento2 is a fresh instance and you must reset the step #7 and restart data migration in this step.
Regards,
Mall.
 

#9
Profile photo of Mall Staff 184060.00 $tone August 1, 2017
Public

Hi Sergio B,

Just a question, can I run reset option from the extension to begin this?

If you just need to keep Invoices and Credit memos, then you just need reset step 7 & 8.
You can still reset all steps to migrate from the ground up again, as your choice.
FYI,
Mall.

#11
Profile photo of Sergio B 340.00 $tone August 22, 2017
Public

It worked, I can do incrementals and the IDs are correct but, I tried to create an order from frontend and the ID was like 00000001.
 
Maybe a problem with incrementals ?
 

#12
Profile photo of Mall Staff 184060.00 $tone August 22, 2017
Public

Hi there,

Maybe a problem with incrementals ?

No, that is working rules of Magento2. You can check more about that in sales sequence meta data table as this: https://prnt.sc/gbo4el
Regards,
Mall.
 

#13
Profile photo of Sergio B 340.00 $tone August 22, 2017
Public

I see *_0 and *_1, corresponding to different websites I thought.
 
for sequence_order_1 there’s a row with a value=1, and incremental as “2”.
 
Please could you give me more details? 

#14

Please login or Register to Submit Answer

Written By

Comments