"""Tests for period picker wizard.""" from odoo.tests.common import TransactionCase, tagged @tagged('post_install', '-at_install') class TestPeriodPickerWizard(TransactionCase): def test_this_month_preset_fills_dates(self): wizard = self.env['fusion.period.picker.wizard'].create({ 'report_type': 'pnl', 'period_preset': 'this_month', }) wizard._onchange_period_preset() self.assertTrue(wizard.date_from) self.assertTrue(wizard.date_to) self.assertEqual(wizard.date_from.day, 1) def test_this_year_preset_uses_ytd(self): wizard = self.env['fusion.period.picker.wizard'].create({ 'report_type': 'pnl', 'period_preset': 'this_year', }) wizard._onchange_period_preset() self.assertEqual(wizard.date_from.month, 1) self.assertEqual(wizard.date_from.day, 1) def test_action_open_report_returns_client_action(self): wizard = self.env['fusion.period.picker.wizard'].create({ 'report_type': 'pnl', 'period_preset': 'this_year', }) wizard._onchange_period_preset() action = wizard.action_open_report() self.assertEqual(action['type'], 'ir.actions.client') self.assertEqual(action['tag'], 'fusion_reports')