feat: add date range wizard (travel)
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
2026-03-14 08:24:57 +00:00
parent f719a668d6
commit 599ad94d2a

View File

@@ -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',
}