xxxxxxxxxxxxxxxxxxxx Posted January 9, 2015 Share Posted January 9, 2015 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? Link to comment Share on other sites More sharing options...
bellini13 Posted January 9, 2015 Share Posted January 9, 2015 Could you explain what you mean by 'reset'? You want the invoice number to restart counting a 1 again? Link to comment Share on other sites More sharing options...
xxxxxxxxxxxxxxxxxxxx Posted January 9, 2015 Author Share Posted January 9, 2015 Exactly. At the beginning of each year invoices should start again from number 1. It's a common thing in Italy. On January 1st, invoice numbers start again from 1. Link to comment Share on other sites More sharing options...
bellini13 Posted January 9, 2015 Share Posted January 9, 2015 Go to your back office, under Orders > Invoices page, and change the starting invoice number. Link to comment Share on other sites More sharing options...
xxxxxxxxxxxxxxxxxxxx Posted January 10, 2015 Author Share Posted January 10, 2015 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? Link to comment Share on other sites More sharing options...
bellini13 Posted January 10, 2015 Share Posted January 10, 2015 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. Link to comment Share on other sites More sharing options...
Recommended Posts