添加功能
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
'views/yuthon_duty_arrangement_views.xml',
|
||||
'views/yuthon_duty_summary_views.xml',
|
||||
'views/yuthon_duty_setting_views.xml',
|
||||
'views/yuthon_abnormal_approval_views.xml',
|
||||
# 'views/attendance_iot_datas.xml',
|
||||
# 'views/attendance_iot_manager_views.xml',
|
||||
# 'views/attendance_iot_views.xml',
|
||||
|
||||
@@ -26,5 +26,6 @@ from . import yuthon_duty_summary
|
||||
from . import yuthon_adjustments_approval
|
||||
from . import yuthon_duty_arrangement
|
||||
from . import yuthon_duty_setting
|
||||
from . import yuthon_abnormal_approval
|
||||
|
||||
|
||||
|
||||
@@ -41,3 +41,26 @@ class HrAttendance(models.Model):
|
||||
for record in self:
|
||||
record.is_abnormal = record.is_no_card or record.is_early_card or record.is_late_card
|
||||
|
||||
def button_leave(self):
|
||||
form_id = self.env.ref('yuthon_holiday.view_hr_leave_batch_form').id
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"name": "请假申请",
|
||||
"res_model": "hr.leave.batch",
|
||||
"views": [[form_id, "form"]],
|
||||
"context": {
|
||||
'default_leave_id': self.employee_id.user_id.id,
|
||||
}
|
||||
}
|
||||
|
||||
def button_compensatory_leave(self):
|
||||
form_id = self.env.ref('yuthon_hr_attendance.view_yuthon_adjustments_approval_form').id
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"name": "调休申请",
|
||||
"res_model": "yuthon.adjustments.approval",
|
||||
"views": [[form_id, "form"]],
|
||||
"context": {
|
||||
'default_users_id': self.employee_id.user_id.id,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
from odoo import api, fields, models, tools, _
|
||||
from datetime import datetime, time, timedelta
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class YuthonAbnormalApproval(models.Model):
|
||||
_name = 'yuthon.abnormal.approval'
|
||||
_inherit = ['soong.workflow.mixin']
|
||||
_description = '值班异常审批'
|
||||
_rec_name = 'name'
|
||||
|
||||
yuthon_company = fields.Selection(related='users_id.employee_id.yuthon_company', string="公司")
|
||||
name = fields.Char(string="标题")
|
||||
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('adjustments_approval'))
|
||||
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
|
||||
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)
|
||||
|
||||
@api.onchange('is_issues')
|
||||
def _onchange_is_issues(self):
|
||||
if self.is_issues:
|
||||
issue_id = self.env['issue.library'].create({'name': self.name})
|
||||
self.related_issues_id = issue_id.id
|
||||
workflow_record_id = self.env["soong.workflow.record"].search(
|
||||
[("res_model", "=", self._name), ("res_id", "=", self.id)])
|
||||
self.env['issue.library.approval.line'].create({
|
||||
'issue_library_id': issue_id.id,
|
||||
'workflow_record_id': workflow_record_id.id,
|
||||
'approval_type': workflow_record_id.workflow_id.id,
|
||||
'code': self.code,
|
||||
'approval_date': fields.Datetime.now(),
|
||||
})
|
||||
elif self.related_issues_id:
|
||||
raise UserError("已经创建了相关的上会记录,不能取消勾选")
|
||||
@@ -51,5 +51,18 @@ class YuthonDutyArrangement(models.Model):
|
||||
}
|
||||
}
|
||||
|
||||
def duty_arrangement_time(self):
|
||||
pass
|
||||
def button_abnormal(self):
|
||||
for record in self:
|
||||
if record.is_abnormal:
|
||||
form_id = self.env.ref("yuthon_hr_attendance.view_yuthon_abnormal_approval_form").id
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': '异常申请',
|
||||
'res_model': 'yuthon.abnormal.approval',
|
||||
"views": [[form_id, "form"]],
|
||||
"context": {
|
||||
'default_users_id':self.employee_id.user_id.id,
|
||||
}
|
||||
}
|
||||
else:
|
||||
raise UserError('当前日期无异常')
|
||||
|
||||
@@ -15,4 +15,5 @@ access_yuthon_adjustments_approval,yuthon.adjustments.approval,model_yuthon_adju
|
||||
access_yuthon_duty_arrangement,yuthon.duty.arrangement,model_yuthon_duty_arrangement,base.group_user,1,1,1,1
|
||||
access_yuthon_duty_setting,yuthon.duty.setting,model_yuthon_duty_setting,base.group_user,1,1,1,1
|
||||
access_yuthon_duty_arrangement_wizard,yuthon.duty.arrangement.wizard,model_yuthon_duty_arrangement_wizard,base.group_user,1,1,1,1
|
||||
access_yuthon_duty_summary_wizard,yuthon.duty.summary.wizard,model_yuthon_duty_summary_wizard,base.group_user,1,1,1,1
|
||||
access_yuthon_duty_summary_wizard,yuthon.duty.summary.wizard,model_yuthon_duty_summary_wizard,base.group_user,1,1,1,1
|
||||
access_yuthon_abnormal_approval,yuthon.abnormal.approval,model_yuthon_abnormal_approval,base.group_user,1,1,1,1
|
||||
|
@@ -19,6 +19,8 @@
|
||||
<field name="check_in" optional="show"/>
|
||||
<!-- <field name="on_card_location" optional="show"/>-->
|
||||
<field name="check_out" optional="show"/>
|
||||
<button name="button_leave" type="object" string="请假" class="oe_highlight"/>
|
||||
<button name="button_compensatory_leave" type="object" string="调休" class="oe_highlight"/>
|
||||
<!-- <field name="down_card_location" optional="show"/>-->
|
||||
<!-- <field name="out_card_time" optional="show"/>-->
|
||||
<!-- <field name="out_card_location" optional="show"/>-->
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_yuthon_abnormal_approval_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.abnormal.approval.tree</field>
|
||||
<field name="model">yuthon.abnormal.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_abnormal_approval_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.abnormal.approval.form</field>
|
||||
<field name="model">yuthon.abnormal.approval</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="值班调休审批">
|
||||
<sheet>
|
||||
<group string="个人信息" col="2">
|
||||
<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>
|
||||
<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_abnormal_approval_action" model="ir.actions.act_window">
|
||||
<field name="name">异常审批</field>
|
||||
<field name="res_model">yuthon.abnormal.approval</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -14,6 +14,7 @@
|
||||
<field name="is_photo_three"/>
|
||||
<field name="is_abnormal"/>
|
||||
<button name="bottom_adjustment" type="object" string="调休" class="btn btn-primary"/>
|
||||
<button name="button_abnormal" type="object" string="异常申请" class="btn btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user