Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to assign current date to a date field in odoo v8

    • 0
    • 2
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 3.48k
    Comment on it

    If you want to create date fields to assign current date in .py file in openerp, you can use the below code for this

    from datetime import date
    from openerp.osv import fields, osv
    from openerp.tools.translate import _
    
    class account_invoice(osv.osv_memory):
        _inherit = "account.invoice
        _columns = {
                    "abc":fields.char('goofball', size=15)
                    }
        _defaults={
            'start_date' : datetime.today().strftime('%m-%d-%Y'),
        }
    

    In above code- 'start_date' : datetime.today().strftime('%m-%d-%Y'), it will pick the current date to a date filed.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: