[ADD ] add new task in hr holiday btn resone refuse
This commit is contained in:
parent
e63239dc85
commit
dcba3065d7
|
|
@ -0,0 +1,128 @@
|
|||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
parts/
|
||||
sdist/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# github action
|
||||
.github/workflows/*yaml
|
||||
|
|
@ -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