Time off changes

This commit is contained in:
Pranay 2025-04-30 18:09:11 +05:30 committed by raman
parent 62df996ae4
commit 426b3d71a4
2 changed files with 47 additions and 0 deletions

View File

@ -340,6 +340,14 @@ class HRLeave(models.Model):
rec.submitted_date = fields.Datetime.now()
self._check_validity()
rec.state = 'confirm'
action = self.sudo().env.ref('hr_holidays.hr_leave_action_my')
return {
'type': 'ir.actions.act_window',
'name': action.name,
'res_model': action.res_model,
'view_mode': action.view_mode,
'target': 'current',
}
def action_reset_confirm(self):
if any(holiday.state not in ['cancel', 'refuse'] for holiday in self):

View File

@ -374,5 +374,44 @@
</field>
</record>
<record id="hr_holidays.hr_leave_action_my" model="ir.actions.act_window">
<field name="context">{}</field>
<field name="view_mode">list,form,calendar,kanban,activity</field>
<field name="view_ids" eval="[(5, 0, 0),(0, 0, {'view_mode': 'list', 'view_id': ref('hr_holidays.hr_leave_view_tree_my')}),(0, 0, {'view_mode': 'calendar', 'view_id': ref('hr_holidays.hr_leave_view_dashboard')}),
(0, 0, {'view_mode': 'kanban', 'view_id': ref('hr_holidays.hr_leave_view_kanban_my')})]"/>
</record>
<record id="hr_leave_view_form_dashboard_new_time_off_inherit" model="ir.ui.view">
<field name="name">hr.leave.view.form.dashboard</field>
<field name="model">hr.leave</field>
<field name="inherit_id" ref="hr_holidays.hr_leave_view_form_dashboard_new_time_off"/>
<field name="priority">100</field>
<field name="arch" type="xml">
<xpath expr="//form" position="inside">
<footer>
<button string="Submit" name="action_draft" type="object" class="oe_highlight"
invisible="state != 'draft'"/>
</footer>
</xpath>
</field>
</record>
<menuitem
id="hr_holidays.hr_leave_menu_new_request"
parent="hr_holidays.menu_hr_holidays_my_leaves"
action="hr_holidays.hr_leave_action_new_request"
sequence="2"/>
<menuitem
id="hr_holidays.hr_leave_menu_my"
parent="hr_holidays.menu_hr_holidays_my_leaves"
action="hr_holidays.hr_leave_action_my"
sequence="1"/>
</data>
</odoo>