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)