Files
Odoo-18.0-20251222/work_trace/wizards/wt_date_range_wizard.py
tocmo0nlord 599ad94d2a
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
feat: add date range wizard (travel)
2026-03-14 08:24:57 +00:00

25 lines
857 B
Python

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