I’ve developed a module that changes the date field of account payment into a datetime field.
Here is the code needed to implement such change:
# Override definition to change Date to DateTime
cls.date = fields.DateTime(cls.date.string, help=cls.date.help,
date = super(Payment, cls).default_date()
return datetime.datetime.combine(date, datetime.datetime.now().time())
def _view_look_dom_arch(cls, tree, type, field_children=None):
# Override date field to use date widget on list
if type == 'tree':
elements = tree.xpath('//field[@name="date"]')
for field in elements:
field.attrib['widget'] = 'date'
return super(Payment, cls)._view_look_dom_arch(
tree, type, field_children)
The only drawback that we found is that this breaks the sqlite as alter type is not suported by sqlite.