leovirgilio
1/12/2017 - 6:33 PM

[magento] Set next increment_id for orders, quotes, invoices, shipments or credit memos

[magento] Set next increment_id for orders, quotes, invoices, shipments or credit memos

Orders

UPDATE eav_entity_store
  INNER JOIN eav_entity_type
  ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id = '100000020'
WHERE eav_entity_type.entity_type_code = 'order'
  AND eav_entity_store.store_id = 1;

Quotes

UPDATE eav_entity_store
  INNER JOIN eav_entity_type
  ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id = '100064999'
WHERE eav_entity_type.entity_type_code = 'quote'
  AND eav_entity_store.store_id = 1;

Invoices

UPDATE eav_entity_store
  INNER JOIN eav_entity_type
  ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id = '100064999'
WHERE eav_entity_type.entity_type_code = 'invoice'
  AND eav_entity_store.store_id = 1;

Shipments

UPDATE eav_entity_store
  INNER JOIN eav_entity_type
  ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id = '100064999'
WHERE eav_entity_type.entity_type_code = 'shipment'
  AND eav_entity_store.store_id = 1;

Credit Memos

UPDATE eav_entity_store
  INNER JOIN eav_entity_type
  ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id = '100064999'
WHERE eav_entity_type.entity_type_code = 'creditmemo'
  AND eav_entity_store.store_id = 1;

Font: https://makandracards.com/magento/8245-set-next-increment-id-for-orders-quotes-invoices-shipments-or-credit-memos

UPDATE eav_entity_store
  INNER JOIN eav_entity_type
  ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
SET eav_entity_store.increment_last_id = '100064999'
WHERE eav_entity_type.entity_type_code = 'creditmemo'
  AND eav_entity_store.store_id = 1;