cancel
Showing results for 
Search instead for 
Did you mean: 

Add a character to credit numbering

Add a character to credit numbering

Hi,

At the moment our credit numbering looks the same as our invoice numbering. This is confusing. Is it somehow possible to add a character to the existing and future credit numbering? So now it looks something like this:

Invoice number: 00034721
Credit number: 00021128

But it would be better if it looked like this (with an added character):

Invoice number: 00034721
Credit number: C00021128

So for example add a character "C" to the existing and future credit numbering to distinguish the two from each other. Is this maybe possible with a command on the database or something?

Regards

6 REPLIES 6

Re: Add a character to credit numbering

Hi @Jojobaa 


You can manage it like below:

Magento 2 database contains a table name 'sales_sequence_profile' which has prefix column and every row contains a meta_id which relates with table 'sales_sequence_meta'.

Table 'sales_sequence_meta' sequence table names according to stores and type(order, invoice, shipment, creditmemo, rma).

  • sequence_order_* contains the last inserted order ids
  • sequence_shipment_* contains the last inserted shipment ids
  • sequence_invoice_* contains the last inserted invoice ids
  • sequence_creditmemo_* contains the last inserted creditmemo ids
  • sequence_rma_item_* contains the last inserted rma item ids

Basically this is just for understanding. You need to update the table 'sales_sequence_profile' and related sequence tables.

 

In your case for credit-memo there will be table like:
sequence_creditmemo_1 

for more info:
Add Prefix

Re: Add a character to credit numbering

Thanks for the reply.

If i do these changes to the database won’t this break any existing orders or credit numbering (for example in the reports etc)? I’m a bit afraid it will break reports and existing orders etc.

Regards

Re: Add a character to credit numbering

@Jojobaa 
I think it will not break.
But I will suggest to try once on staging or on local server.

and take FULL BACKUP of the database before making live.

Re: Add a character to credit numbering

@Jojobaa 

I have tried for order, it works fine for me.   PFA for the reference.

Screenshot from 2019-06-20 19-45-12.pngScreenshot from 2019-06-20 19-44-50.pngScreenshot from 2019-06-20 19-44-23.png

Please clear cache and re-indexing after change.

php bin/magento cache:flush
php bin/magento indexer:reindex

I hope it will help you!

Re: Add a character to credit numbering

@Vimal Kumar 

Thanks for the reply. I see the following:  http://prntscr.com/oa5ind
I'm not totally sure where to add the prefix exactly? Should I edit all rows 1 till 8 and change the "prefix" table in all 8 rows from "NULL" to for example the character "C" ?

Regards

Re: Add a character to credit numbering

Hi @Jojobaa 

You don't need to add prefix in all the rows. You need to add prefix only for meta_id for which you want to edit.

You can check meta_id reference from "sales_sequence_meta" table. I have already added screenshot in above reply. For example in my secreenshot, for order there are meta_id for order are 1,5,9,13. 

You can also check same in "sales_sequence_meta" meta_id and add prefix only for those meta_ids in "sales_sequence_profile".

I hope it is clear now or you can ask if you have any query.