Jump to content

Recommended Posts

Hello,

is it possible to reset the invoice number when a new year starts?

 

I just thought about it. Is it something that Prestashop can do automtically? do I need to change some code or use a plugin?

Share this post


Link to post
Share on other sites

Could you explain what you mean by 'reset'?

 

You want the invoice number to restart counting a 1 again?

Share this post


Link to post
Share on other sites

Go to your back office, under Orders > Invoices page, and change the starting invoice number.

Share this post


Link to post
Share on other sites

Thanks, but if I try to set the invoice number to 1 is gives me an error message saying that the number is not valid... maybe because there is already an invoice number 1?

Any idea?

Share this post


Link to post
Share on other sites

The controller has this logic, that validates if the new number is less than the last used number. 

 

You can remove this logic from the controller if you would like to try it.  I cannot say how this is going to work, that is something you are going to have to test.  I'm sure there is a reason that they are trying to prevent you from doing this, that is something you will likely find out in your testing.

 

You also do not say which version of Prestashop you are using, so I'm assuming PS v1.6.0.9

 

Edit controllers\admin\AdminInvoicesController.php

 

Locate line 251 which has the following code

    public function beforeUpdateOptions()
    {
        if ((int)Tools::getValue('PS_INVOICE_START_NUMBER') != 0 && (int)Tools::getValue('PS_INVOICE_START_NUMBER') <= Order::getLastInvoiceNumber())
            $this->errors[] = $this->l('Invalid invoice number.').Order::getLastInvoiceNumber().')';
    }

and remove those lines and perform your testing.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More