Odoo Help


Openerp Import date format

on 11/13/13, 11:18 AM 3,036 views

In Openerp Import options Default Date format supports YYYY-MM-DD and Header Options Must

How to change the date format for Particular table (only) and auto fill Header details



| 5 4 7
Bikaner, India

OpenERP Devloper at SunARC Technology

On 3/10/14, 10:49 AM

Openerp 7 the below code (overridden ORM load method to change the Import Data format

def checkdatatype(self, cr, uid, date, context=None):
       dateValue = False
       data = {}
       for format in ['%Y%m%d']:
                result = datetime.datetime.strptime(date, format)
                datatype = (date == result.strftime(format)) 
       if  datatype:
           msg = 'Date Type'
           data['msg'] = 'Date Type'
            msg = 'other'
            data['msg'] = 'other'
       return data     

    def load(self, cr, uid, fields, data, context=None):
        Listalldata = []
        for value in data:
            Listdata = list(value)
        for listvalue in Listalldata:        
            for i, val in enumerate(listvalue):
                res = self.checkdatatype(cr, uid, str(val), context=context)
                if res['msg']=='Date Type':
                     listvalue[i] = datetime.datetime.strptime(val, '%Y%m%d').strftime('%Y-%m-%d')
        data = []
        for val in Listalldata:
            Listalldata = tuple(val)
        return super(model_class_name, self).load(cr, uid, fields, data, context=context)
On 11/14/13, 3:26 AM

You can change by check the menu " Administration -> Translation -> Languages -> Click Language and check format. In this select the language and switch to form view then there u will see the field date format . You can change there after changing just relogin to the database . Job Done.

Hope this will help you.

Using this options Date Format changed in the form view {For example in Sale order Date format changed based on settings). But Import data in OpenERP always support in the format YYYY-MM-DD how to change the format in import data.

on 11/22/13, 9:48 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

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

0 follower(s)


Asked: 11/13/13, 11:18 AM
Seen: 3036 times
Last updated: 3/16/15, 8:10 AM