# -*- coding: utf-8 -*-# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).fromopenerpimportapi,fields,models,_fromopenerp.exceptionsimportValidationErrorclassShiftLeaveWizard(models.TransientModel):_inherit='shift.leave.wizard'@api.multidefbutton_confirm(self):self.ensure_one()leave=self.leave_idifnotself._context.get('bypass_non_draft_confirm',False)and \leave.state!='draft':raiseValidationError(_("You can not confirm a leave in a non draft state."))ifleave.non_defined_typeandleave.non_defined_leave:leave.update_registration_template_based_non_define_leave()else:super(ShiftLeaveWizard,self).button_confirm()leave.update_info_anticipated_leave()