Documents such as invoice, accounting vouchers required number series based on the financial years, it start with 1 every first day of the new fiscal year. For example, 2013, you run to number INV/2013/0986. On the new year, you may want it to reset to INV/2014/0001.
Overview of steps
- First, make sure the new Fiscal Year has been created, e.g., FY14
- Copy the old sequence to create a new sequence, reset the next number to 1. E.g., copy sequence Sales Journal -> Sales Journal (FY14)
- In Fiscal Year tab of original sequence Sales Journal, setup the next year sequence FY to Sales Journal (FY14)
There is a good tutorial here explain how to do it already, this tutorial is pretty much the same, except we want to do many sequence all at once using import file.
- Lets first export all sequence that we want to reset. Go to Sequences window (Setting > Configuration > Sequences & Identifiers) and make advance filter for,
- Next Number > 1 and Prefix contains “(year)”
- Use that exported data to create CSV import file for all sequence FY14. Import this CSV file to Sequences window. Following is the example.
|Purchase Journal (FY14)||No gap||1||5||1||SINV/%(year)s/|
|Sales Journal (FY14)||No gap||1||5||1||INV/%(year)s/|
|Sales Refund Journal (FY14)||No gap||1||5||1||CN/%(year)s/|
- Create CSV file to setup the next year sequence FY to the original sequences. Import this file to Sequences window. Following is the example,
|__export__.ir_sequence_36||Purchase Journal||2014||Purchase Journal (FY14)|
|__export__.ir_sequence_35||Sales Journal||2014||Sales Journal (FY14)|
|__export__.ir_sequence_37||Sales Refund Journal||2014||Sales Refund Journal (FY14)|
You can now check whether the original sequence’s fiscal year tab has point to the new sequence for the new fiscal year. Then try changing the server date and see the effect.
- OpenERP only allow resetting of Sequence only for document with Journal, i.e., Invoices, Voucher. For non Journal document, like Sales Order there is no context[‘fiscalyear_id’] passed, so it not works.
- We have make a small module ir_sequence_fy_alldoc, to ensure that if context[‘fiscalyear_id’] is not passed, use today to get the Fiscal Year.