Odoo Help


How to change the Journal Sequence to date in posting?

Peter Hall
on 3/3/14, 1:49 PM 985 views


I am asking to find out how to change the Journal sequence year from posting date to the transaction date.

Example: My fiscal year ends December 31st. If I have a transaction date December 15, 2013 but I'm posting it on March 3rd 2014 The Journal number has 2014 in it. It should be 2013.

I need this to be modified in the scripts and not just through the sequence settings

How should I modify the ir_sequence.py script :

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),

Can I change " t = time.localtime() # Actually, the server is always in UTC." to t = transaction date somehow

Please any help will be appreciated

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/3/14, 1:49 PM
Seen: 985 times
Last updated: 3/16/15, 8:10 AM