commit
0cd45ea14d
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
'wizards/holidays_public_next_year_wizard.xml',
|
||||
'wizards/holiday_public_leave_report_view.xml',
|
||||
'wizards/hr_reject_wizard_view.xml',
|
||||
|
||||
'report/public_leave_report_template.xml',
|
||||
'report/public_leave_cost_template.xml',
|
||||
|
|
|
|||
|
|
@ -3582,3 +3582,53 @@ msgstr ""
|
|||
#: model:ir.model.fields.selection,name:hr_holidays_public.selection__hr_holidays_status__leave_type__death
|
||||
msgid "وفـاة"
|
||||
msgstr ""
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: code:addons/hr_holidays_public/models/hr_holidays.py:0
|
||||
#, python-format
|
||||
msgid "Specify Reject Reason"
|
||||
msgstr "سبب الرفض"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model_terms:ir.ui.view,arch_db:hr_holidays_public.pubic_leave_report_wizard_view
|
||||
#: model_terms:ir.ui.view,arch_db:hr_holidays_public.reject_wizard
|
||||
msgid "or"
|
||||
msgstr "او"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: code:addons/hr_holidays_public/wizards/hr_reject_wizard.py:0
|
||||
#, python-format
|
||||
msgid "Sorry This object have no field named Selection Reason"
|
||||
msgstr "لابد من ادخال سبب الرفض"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model_terms:ir.ui.view,arch_db:hr_holidays_public.reject_wizard
|
||||
msgid "Reject"
|
||||
msgstr "رفض"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model:ir.model.fields,field_description:hr_holidays_public.field_hr_holidays__reject_reason
|
||||
#: model:ir.model.fields,field_description:hr_holidays_public.field_hr_reject_wizard__reject_reason
|
||||
#: model_terms:ir.ui.view,arch_db:hr_holidays_public.hr_holidays_ext_form_view
|
||||
msgid "Reject Reason"
|
||||
msgstr "سبب الرفض"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model:ir.model.fields,field_description:hr_holidays_public.field_hr_reject_wizard__origin
|
||||
msgid "Origin"
|
||||
msgstr "الاصل"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model:ir.model.fields,field_description:hr_holidays_public.field_hr_reject_wizard__origin_name
|
||||
msgid "Origin Name"
|
||||
msgstr "اسم الحقل"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model:ir.model,name:hr_holidays_public.model_hr_reject_wizard
|
||||
msgid "HR Reject Wizard"
|
||||
msgstr "سبب الرفض للاجازات"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model_terms:ir.ui.view,arch_db:hr_holidays_public.reject_wizard
|
||||
msgid "Close"
|
||||
msgstr "إغلاق"
|
||||
|
|
@ -30,7 +30,7 @@ class HRHolidays(models.Model):
|
|||
start_date = fields.Date(string="Start Date", default=fields.Datetime.now())
|
||||
end_date = fields.Date(string="End Date")
|
||||
notes = fields.Text()
|
||||
|
||||
reject_reason = fields.Text(string='Reject Reason')
|
||||
issuing_exit_return = fields.Selection(selection=[('yes', _('Yes')), ('no', _('No'))], default='no')
|
||||
check_allocation_view = fields.Selection(selection=[('allocation', _('Allocation')), ('balance', _('Balance'))])
|
||||
exit_return_duration = fields.Float(related='number_of_days_temp')
|
||||
|
|
@ -1184,6 +1184,21 @@ class HRHolidays(models.Model):
|
|||
balance.write({'remaining_leaves': balance.remaining_leaves - allocation.number_of_days_temp, })
|
||||
|
||||
def refuse(self):
|
||||
action_name = _('Specify Reject Reason')
|
||||
reject_reason = self.env.context.get('reject_reason')
|
||||
if reject_reason:
|
||||
return self.action_refuse(reject_reason)
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': action_name,
|
||||
'res_model': 'hr.reject.wizard',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'context': {'default_origin': self.id, 'default_origin_name': self._name}
|
||||
}
|
||||
|
||||
def action_refuse(self,reject_reason=""):
|
||||
for item in self:
|
||||
have_cancel_request = self.env['leave.cancellation'].search(
|
||||
[('leave_request_id', '=', item.id), ('state', 'not in', ('draft', 'refuse'))])
|
||||
|
|
@ -1213,7 +1228,7 @@ class HRHolidays(models.Model):
|
|||
item.remove_delegated_access()
|
||||
item.call_cron_function()
|
||||
self.check_allocation_balance_annual('addition')
|
||||
item.write({'state': 'refuse'})
|
||||
item.write({'state': 'refuse','reject_reason':reject_reason})
|
||||
|
||||
@api.onchange('holiday_status_id')
|
||||
def _get_holiday_related_date(self):
|
||||
|
|
|
|||
|
|
@ -28,3 +28,4 @@ access_hr_holidays_status_duration,access_hr_holidays_duration,model_holiday_sta
|
|||
access_public_leave_report_user,access_public_leave_report,model_public_leave_report,base.group_user,1,1,1,0
|
||||
access_public_holidays_next_year_wizard_user,access_public_holidays_next_year_wizard,model_public_holidays_next_year_wizard,base.group_user,1,1,1,0
|
||||
access_zfp_hr_custom_buy_vacation,zfp_hr_custom.buy_vacation,model_buy_vacation,base.group_user,1,1,1,1
|
||||
access_hr_reject_wizard,access_hr_reject_wizard,model_hr_reject_wizard,base.group_user,1,1,1,1
|
||||
|
|
|
@ -112,6 +112,9 @@
|
|||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Reject Reason" name="reject_reason" attrs="{'invisible':[('reject_reason','=',False)]}">
|
||||
<field name="reject_reason" string="Reject Reason" readonly="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</xpath>
|
||||
<header position="replace">
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from . import holidays_public_next_year_wizard
|
||||
from . import holiday_public_leave_report_wiz
|
||||
from . import hr_reject_wizard
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Expert Co. Ltd.
|
||||
# Copyright (C) 2018 (<http://www.exp-sa.com/>).
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import Warning, ValidationError
|
||||
|
||||
|
||||
|
||||
class RejectWizard(models.TransientModel):
|
||||
_name = 'hr.reject.wizard'
|
||||
_description = 'HR Reject Wizard'
|
||||
origin = fields.Integer('')
|
||||
reject_reason = fields.Text(string='Reject Reason')
|
||||
origin_name = fields.Char('')
|
||||
|
||||
def action_reject(self):
|
||||
origin_rec = self.env[self.origin_name].sudo().browse(self.origin)
|
||||
if dict(self._fields).get('reject_reason') is None:
|
||||
raise ValidationError(_('Sorry This object have no field named Selection Reason'))
|
||||
else:
|
||||
return origin_rec.action_refuse(self.reject_reason)
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="reject_wizard" model="ir.ui.view">
|
||||
<field name="name">Reject Reason</field>
|
||||
<field name="model">hr.reject.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<field name="origin" invisible="1"/>
|
||||
<field name="reject_reason" required="1"/>
|
||||
<footer>
|
||||
<div>
|
||||
<button name="action_reject" string="Reject" type="object" default_focus="1" class="btn-primary"/>
|
||||
or
|
||||
<button string="Close" special="cancel" class="btn-secondary"/>
|
||||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Loading…
Reference in New Issue