Community mailing list archives

Re: Sales Journal Sequence

Atchuthan - Technical Consultant, Sodexis Inc
- 09/12/2014 04:24:13
Hi Yassine,

The format sequence available in ir.sequence models are:
    def _interpolation_dict(self):
        t = time.localtime() # Actually, the server is always in UTC.
        return {
            'year': time.strftime('%Y', t),
            'month': time.strftime('%m', t),
            'day': time.strftime('%d', t),
            'y': time.strftime('%y', t),
            'doy': time.strftime('%j', t),
            'woy': time.strftime('%W', t),
            'weekday': time.strftime('%w', t),
            'h24': time.strftime('%H', t),
            'h12': time.strftime('%I', t),
            'min': time.strftime('%M', t),
            'sec': time.strftime('%S', t),

Create a custom module in which you can create a new format sequence by inheriting 'ir.sequence' model.

from openerp.osv import orm
from datetime import datetime
from dateutil.relativedelta import *

class ir_sequence(orm.Model):
    _inherit = 'ir.sequence'
    def _interpolation_dict(self):
        res = super(ir_sequence, self)._interpolation_dict()
        res['month1before']=datetime.strftime( - relativedelta(months=1), '%m')
        return res  

In the sequence, change the prefix to "%(month1before)/"

On Thu, Sep 11, 2014 at 2:26 PM, Yassine Teimi <> wrote:

Hello Everybody,

I want to give my invoices a number like : (actual month -1)/invoice Serial number, for example, this is month 9, I want that the system gives my invoices a number like 08/39000, I can now only give my invoices a number like : 09/39000

I tried in the prefix to do : %((month)s-1) but the minus 1 does'nt work.

Thanks in advance for your precious help.


Yassine TEIMI

Ingénieur SI technico-fonctionnel

TEL : 06-27333078

Post to: