From 599ad94d2a4d2002bf99a186a1b0deee48a47f2b Mon Sep 17 00:00:00 2001 From: tocmo0nlord Date: Sat, 14 Mar 2026 08:24:57 +0000 Subject: [PATCH] feat: add date range wizard (travel) --- work_trace/wizards/wt_date_range_wizard.py | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 work_trace/wizards/wt_date_range_wizard.py diff --git a/work_trace/wizards/wt_date_range_wizard.py b/work_trace/wizards/wt_date_range_wizard.py new file mode 100644 index 00000000..6e53b510 --- /dev/null +++ b/work_trace/wizards/wt_date_range_wizard.py @@ -0,0 +1,24 @@ +from odoo import models, fields, _ +from odoo.exceptions import UserError + + +class WtDateRangeWizard(models.TransientModel): + _name = 'wt.date.range.wizard' + _description = 'WorkTrace Date Range' + + date_from = fields.Date(string='From', required=True) + date_to = fields.Date(string='To', required=True) + + def action_view(self): + self.ensure_one() + if self.date_from > self.date_to: + raise UserError(_('Start date must be before end date.')) + return { + 'type': 'ir.actions.act_window', + 'name': 'Travel: %s → %s' % (self.date_from, self.date_to), + 'res_model': 'wt.location.log', + 'view_mode': 'list,form', + 'domain': [('date', '>=', self.date_from), ('date', '<=', self.date_to)], + 'context': {}, + 'target': 'current', + }