python - How to get current time in datetime format in XML file of odoo? -
my code follows....
my model ...
class today_status(models.model): _name = 'today.status' current_time = datetime.now().strftime('%y-%m-%d %h:%m:%s') starttime = fields.many2one(comodel_name='book.meeting')
my xml file follows...
<record model="ir.actions.act_window" id="dashboard-menu"> <field name="name">dashboard</field> <field name="res_model">today.status</field> <field name="view_type">form</field> <field name="view_mode">tree,form</field> <field name="domain">[("start_time", ">=", "current_time")]</field> <field name="view_id" ref="dash-view"/> </record>
i want current time in xml or want use variable current_time specified in model in xml file. how possible?
just need set below domain , check module after upgrading module.
[('date','>=', ((context_today()).strftime('%y-%m-%d'))+' '+'00:00:00'),('date','<=', ((context_today()).strftime('%y-%m-%d'))+' '+'23:59:59')]
also add new datetime field date in model.
i hope answer may helpful :)
Comments
Post a Comment