添加功能
This commit is contained in:
@@ -1 +1,2 @@
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -12,10 +12,12 @@
|
||||
'views/inherit_hr_leave_allocation_views.xml',
|
||||
'views/inherit_hr_leave_accrual_plan_views.xml',
|
||||
'views/hr_leave_accrual_views.xml',
|
||||
'views/yuthon_fixes_approval_views.xml',
|
||||
'views/hr_leave_batch.xml',
|
||||
'wizard/yuthon_fixes_wizard_views.xml',
|
||||
],
|
||||
'demo': [],
|
||||
'depends': ['hr_holidays', 'planning', 'hr', 'yuthon_hr_employee'],
|
||||
'depends': ['hr_holidays', 'planning', 'hr', 'yuthon_hr_employee', 'base', 'yuthon_issue', 'documents'],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
}
|
||||
|
||||
@@ -2,3 +2,4 @@ from . import inherit_hr_leave_allocation
|
||||
from . import inherit_hr_leave_type
|
||||
from . import inherit_hr_leave
|
||||
from . import inherit_hr_leave_accrual_plan
|
||||
from . import yuthon_fixes_approval
|
||||
|
||||
@@ -84,3 +84,19 @@ class HrLeaveAllocation(models.Model):
|
||||
if allocation_vals:
|
||||
self.env['hr.leave.allocation'].with_context(mail_notify_force_send=False, mail_activity_automation_skip=True).create(allocation_vals)
|
||||
self.linked_request_ids.filtered(lambda c: c.state != 'validate').action_validate()
|
||||
|
||||
def button_fixes_wizard(self):
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"name": "修正申请",
|
||||
"res_model": "yuthon.fixes.wizard",
|
||||
"view_mode": 'form',
|
||||
'target': 'new',
|
||||
"context": {
|
||||
'default_users_id': self.employee_id.user_id.id,
|
||||
'default_duration_display': self.duration_display,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,4 +10,8 @@ class HrLeaveType(models.Model):
|
||||
request_unit = fields.Selection([('day', '天'), ('hour', '小时'), ('half_day', '半天')], string="请假单位", default='hour')
|
||||
employee_requests = fields.Selection([('yes', '允许的额外天数要求'), ('no', '不允许')], string='员工要求', default='yes')
|
||||
allocation_validation_type = fields.Selection(defalt='no')
|
||||
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='公司')
|
||||
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='公司')
|
||||
start_date = fields.Date(string="生效日期", default=fields.Date.today())
|
||||
expiration_date = fields.Date(string="失效日期")
|
||||
is_enable = fields.Boolean(string="启用", default=True)
|
||||
employee_ids = fields.Many2many('hr.employee', string='人员范围')
|
||||
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class YuthonFixesApproval(models.Model):
|
||||
_name = 'yuthon.fixes.approval'
|
||||
_description = '假期修正审批'
|
||||
_inherit = 'soong.workflow.mixin'
|
||||
|
||||
yuthon_company = fields.Selection(related='users_id.employee_id.yuthon_company', string="公司")
|
||||
name = fields.Char(string="标题")
|
||||
code = fields.Char(string="编号")
|
||||
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
|
||||
original_days = fields.Char(string="原休假天数")
|
||||
now_days = fields.Char(string="现休假天数")
|
||||
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
related_issues_id = fields.Many2one('issue.library', string="关联议题")
|
||||
reason_application = fields.Html(string="申请事由")
|
||||
documents_ids = fields.Many2many('ir.attachment', string="附件")
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_hr_leave_batch,hr_leave_batch,model_hr_leave_batch,base.group_user,1,1,1,1
|
||||
access_hr_leave_line,hr_leave_line,model_hr_leave_line,base.group_user,1,1,1
|
||||
access_hr_leave_type,hr_leave_type,model_hr_leave_type,base.group_user,1,1,1,1
|
||||
access_hr_leave_type,hr_leave_type,model_hr_leave_type,base.group_user,1,1,1,1
|
||||
access_yuthon_fixes_approval,yuthon_fixes_approval,model_yuthon_fixes_approval,base.group_user,1,1,1,1
|
||||
access_yuthon_fixes_wizard,yuthon_fixes_wizard,model_yuthon_fixes_wizard,base.group_user,1,1,1,1
|
||||
|
@@ -17,6 +17,9 @@
|
||||
<xpath expr="//tree/field[@name='date_to']" position="attributes">
|
||||
<attribute name="string">结束时间</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//tree/field[@name='state']" position="after">
|
||||
<button name="button_fixes_wizard" string="修正" type="object" class="oe_highlight"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_holiday_allocation_form" model="ir.ui.view">
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
<xpath expr="//field[@name='allocation_validation_type']" position="attributes">
|
||||
<attribute name="column_invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='work_entry_type_id']" position="after">
|
||||
<field name="start_date"/>
|
||||
<field name="expiration_date"/>
|
||||
<field name="is_enable"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_holiday_type_form" model="ir.ui.view">
|
||||
@@ -23,6 +28,9 @@
|
||||
<field name="leave_documents_id" widget="preview_many2many"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='requires_allocation']" position="before">
|
||||
<field name="employee_ids" widget="many2many_tags"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='leave_documents_id']" position="after">
|
||||
<field name="yuthon_company"/>
|
||||
<field name="duration_calculation"/>
|
||||
@@ -44,4 +52,28 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_leave_type_form" model="ir.actions.act_window">
|
||||
<field name="name">全部</field>
|
||||
<field name="res_model">hr.leave.type</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<record id="action_leave_type_form1" model="ir.actions.act_window">
|
||||
<field name="name">天河投资</field>
|
||||
<field name="res_model">hr.leave.type</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('yuthon_company','=','thtz')]</field>
|
||||
</record>
|
||||
<record id="action_leave_type_form2" model="ir.actions.act_window">
|
||||
<field name="name">天河粮储</field>
|
||||
<field name="res_model">hr.leave.type</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('yuthon_company', '=', 'thlc')]</field>
|
||||
</record>
|
||||
<record id="action_leave_type_form3" model="ir.actions.act_window">
|
||||
<field name="name">天河物管</field>
|
||||
<field name="res_model">hr.leave.type</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('yuthon_company', '=', 'thwg')]</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_yuthon_fixes_approval_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.fixes.approval.tree</field>
|
||||
<field name="model">yuthon.fixes.approval</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="假期修正审批">
|
||||
<field name="name"/>
|
||||
<field name="users_id"/>
|
||||
<field name="yuthon_company"/>
|
||||
<field name="department_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_fixes_approval_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.fixes.approval.form</field>
|
||||
<field name="model">yuthon.fixes.approval</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="假期修正审批">
|
||||
<sheet>
|
||||
<group string="个人信息" col="3">
|
||||
<group>
|
||||
<field name="users_id"/>
|
||||
<field name="is_issues"/>
|
||||
<field name="related_issues_id" invisible="not is_issues"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="yuthon_company"/>
|
||||
<field name="department_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="original_days"/>
|
||||
<field name="now_days"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="审批事项">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="reason_application"/>
|
||||
<field name="documents_ids" widget="preview_many2many"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_fixes_approval_action" model="ir.actions.act_window">
|
||||
<field name="name">假期修正审批</field>
|
||||
<field name="res_model">yuthon.fixes.approval</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -0,0 +1 @@
|
||||
from . import yuthon_fixes_wizard
|
||||
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class YuthonFixesWizard(models.TransientModel):
|
||||
_name = 'yuthon.fixes.wizard'
|
||||
_description = '修正按钮弹窗'
|
||||
|
||||
remediate_days = fields.Char(string='修正天数')
|
||||
users_id = fields.Many2one('res.users')
|
||||
duration_display = fields.Char(string='假期余额')
|
||||
|
||||
def confirm(self):
|
||||
form_id = self.env.ref('yuthon_holiday.view_yuthon_fixes_approval_form').id
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"name": "修正申请",
|
||||
"res_model": "yuthon.fixes.approval",
|
||||
"views": [[form_id, "form"]],
|
||||
"context": {
|
||||
'default_users_id': self.users_id.id,
|
||||
'default_now_days': self.remediate_days,
|
||||
'default_original_days': self.duration_display
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_yuthon_fixes_wizard_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.fixes.wizard.form</field>
|
||||
<field name="model">yuthon.fixes.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="修正">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="users_id" invisible="1"/>
|
||||
<field name="duration_display" invisible="1"/>
|
||||
<field name="remediate_days"/>
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button name="confirm" string="确认" type="object" class="oe_highlight"/>
|
||||
<button string="返回" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -257,15 +257,24 @@
|
||||
parent="holiday_manage_menu_root_board"
|
||||
action="hr_holidays.action_hr_holidays_dashboard"
|
||||
sequence="3"/>
|
||||
<menuitem id="hr_leave_batch_action_all_board"
|
||||
name="休假"
|
||||
parent="holiday_manage_menu_root_board"
|
||||
action="yuthon_holiday.hr_leave_batch_action_all"
|
||||
sequence="4"/>
|
||||
<menuitem id="holiday_my_allocation_menu_board"
|
||||
name="假期余额"
|
||||
parent="holiday_manage_menu_root_board"
|
||||
action="hr_holidays.hr_leave_allocation_action_my"
|
||||
sequence="4"/>
|
||||
<menuitem id="hr_leave_batch_action_process_board"
|
||||
name="流程"
|
||||
parent="holiday_manage_menu_root_board"
|
||||
sequence="7"/>
|
||||
<menuitem id="hr_leave_batch_action_all_board"
|
||||
name="休假"
|
||||
parent="hr_leave_batch_action_process_board"
|
||||
action="yuthon_holiday.hr_leave_batch_action_all"
|
||||
sequence="1"/>
|
||||
<menuitem id="holiday_yuthon_fixes_approval_board"
|
||||
name="修正"
|
||||
parent="hr_leave_batch_action_process_board"
|
||||
action="yuthon_holiday.view_yuthon_fixes_approval_action"
|
||||
sequence="7"/>
|
||||
<menuitem id="holiday_set_menu_board"
|
||||
name="配置"
|
||||
@@ -274,8 +283,27 @@
|
||||
<menuitem id="holiday_set_type_board"
|
||||
name="休假类型"
|
||||
parent="holiday_set_menu_board"
|
||||
action="hr_holidays.open_view_holiday_status"
|
||||
sequence="1"/>
|
||||
<menuitem id="holiday_set_type_board1"
|
||||
name="全部"
|
||||
parent="holiday_set_type_board"
|
||||
action="yuthon_holiday.action_leave_type_form"
|
||||
sequence="1"/>
|
||||
<menuitem id="holiday_set_type_board2"
|
||||
name="天河投资"
|
||||
parent="holiday_set_type_board"
|
||||
action="yuthon_holiday.action_leave_type_form1"
|
||||
sequence="3"/>
|
||||
<menuitem id="holiday_set_type_board3"
|
||||
name="天河粮储"
|
||||
parent="holiday_set_type_board"
|
||||
action="yuthon_holiday.action_leave_type_form2"
|
||||
sequence="5"/>
|
||||
<menuitem id="holiday_set_type_board4"
|
||||
name="天河物管"
|
||||
parent="holiday_set_type_board"
|
||||
action="yuthon_holiday.action_leave_type_form3"
|
||||
sequence="7"/>
|
||||
<menuitem id="holiday_set_scheme_board"
|
||||
name="年假配置"
|
||||
parent="holiday_set_menu_board"
|
||||
|
||||
Reference in New Issue
Block a user