Merge pull request !544 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2024-11-23 10:37:43 +00:00
committed by Gitee
50 changed files with 261 additions and 239 deletions
+2 -3
View File
@@ -15,13 +15,12 @@ class YuthonUserRole(models.Model):
create_time = fields.Datetime(string="创建时间", default=fields.Datetime.now)
end_time = fields.Datetime(string="结束时间")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建'),
('thtjbb', '天河投资本部')], string="所属公司", compute='compute_company')
('thlc', '天河粮储'), ('thtjbb', '天河投资本部')], string="所属公司", compute='compute_company')
@api.depends('department_id')
def compute_company(self):
company_mapping = {'天河投资集团': 'thtz', '天河物管': 'thwg',
'天河粮储': 'thlc', '天投城建': 'tctj',
'天河粮储': 'thlc',
'天河投资本部': 'thtjbb'}
for record in self:
visited_departments = set()
+1 -1
View File
@@ -104,7 +104,7 @@ class SoongWorkflow(models.Model):
@api.depends('start_date', 'end_date')
def compute_is_enable(self):
for rec in self:
if rec.start_date and rec.end_date:
if rec.start_date and rec.end_date and self.name:
if rec.start_date <= fields.Date.today() < rec.end_date:
is_enable_ids = self.search([('model_id', '=', self.model_id.id), ('is_enable', '=', True)])
if len(is_enable_ids) <= 1:
+18 -18
View File
@@ -130,23 +130,23 @@ class SoongWorkflowNode(models.Model):
"action_type": "code",
"code": "obj.action_withdraw()",
},),
(0, 0, {
"name": _("加签"),
"workflow_id": val['workflow_id'],
"sequence": 3,
"action_type": "code",
"has_comment": True,
},),
(0, 0, {
"name": _("转交"),
"workflow_id": val['workflow_id'],
"sequence": 3,
"action_type": "code",
"btn_hide": True,
"review_type": 'expression',
# "reviewer_expression": "obj.action_withdraw()", # todo domain
"has_comment": True,
},),
# (0, 0, {
# "name": _("加签"),
# "workflow_id": val['workflow_id'],
# "sequence": 3,
# "action_type": "code",
# "has_comment": True,
# },),
# (0, 0, {
# "name": _("转交"),
# "workflow_id": val['workflow_id'],
# "sequence": 3,
# "action_type": "code",
# "btn_hide": True,
# "review_type": 'expression',
# # "reviewer_expression": "obj.action_withdraw()", # todo domain
# "has_comment": True,
# },),
(0, 0, {
"name": _("退回"),
"workflow_id": val['workflow_id'],
@@ -300,7 +300,7 @@ class SoongWorkflowNodeButton(models.Model):
required=True,
ondelete="cascade",
)
is_automatic = fields.Boolean('是否自动匹配', default=True)
is_automatic = fields.Boolean('是否自动匹配', default=True, help='该节点默认拟办人员的部门相应人员。必须是系统全局角色')
@api.onchange("node_id")
def change_workflow(self):
@@ -161,7 +161,7 @@
name="reviewer_group_id"
invisible="review_type != 'group'"
/>
<field name="users_role_id" invisible="review_type != 'user_role'" required="review_type == 'user_role'"/>
<field name="users_role_id" invisible="review_type != 'user_role'" required="review_type == 'user_role' and btn_hide"/>
</group>
<group invisible="review_type != 'expression' or btn_hide == False">
<div class="alert alert-danger oe_edit_only" role="alert" style="width: max-content;">
@@ -85,7 +85,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self.res_model, record_id.id)
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa',
user_id=employee.wecom_userid,
title="审批抄送提醒",
title=record_id.name + "审批抄送提醒",
description="您有新的抄送提醒请及时查看",
url=url, btntxt="详细信息")
# 转交逻辑--单线
@@ -98,7 +98,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
url = 'https://oa.thtzjt.com/mail/view?model={}&res_id={}'.format(self.res_model, self.res_id)
for employee in self.employee_ids:
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', user_id=employee.wecom_userid,
title=self.name,
title=record_id.name,
description="您有新的审批单请及时处理",
url=url, btntxt="详情")
return self.node_btn_id.with_context(cx).run()
@@ -107,7 +107,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
url = 'https://oa.thtzjt.com/mail/view?model={}&res_id={}'.format(self.res_model, self.res_id)
for employee in self.employee_ids:
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa', user_id=employee.wecom_userid,
title=self.name,
title=record_id.name,
description="您的审批单已被退回,请查看详情",
url=url, btntxt="详情")
return self.node_btn_id.with_context(cx).run()
@@ -10,5 +10,4 @@ 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', '天河粮储'),
('tctj', '天投城建')], string='公司')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='公司')
+2 -2
View File
@@ -29,9 +29,9 @@ class HrAttendance(models.Model):
def add_comment(self):
self.ensure_one()
if not self.wecom_userid:
if not self.wecom_userid:
raise ("请同步{}的企业微信".format(self.name))
url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self.hr_attendance, self.employee_id.id)
url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self._name, self.id)
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='attendance', user_id=self.wecom_userid,
title="打卡异常提醒", description="测试消息请忽略",
url=url, btntxt="详细信息")
+1 -2
View File
@@ -6,8 +6,7 @@ class OvertimePage(models.Model):
_name = 'overtime.page'
_description = '加班说明配置'
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储'),
('tctj', '天投城建')], string='公司')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='公司')
department_id = fields.Many2one("hr.department", string="部门")
day_time = fields.Char(string="每日加班时长不得超过")
month_time = fields.Char(string="每月加班时长不得超过")
@@ -26,22 +26,6 @@ class YuthonDutyArrangement(models.Model):
is_abnormal = fields.Boolean(string='是否异常')
weekday_count = fields.Float(string='值班次数')
@api.model_create_multi
def create(self, vals_list):
performance_records = super().create(vals_list)
for performance in performance_records:
summary = self.env['yuthon.duty.summary'].search([
('employee_id', '=', performance.employee_id.id),
])
if summary:
pass
else:
summary = self.env['yuthon.duty.summary'].create({
'employee_id': performance.employee_id.id,
'duty_arrangement_id': performance.id,
})
return performance_records
@api.depends('duration', 'duration_two', 'duration_three')
def _compute_is_photo(self):
for record in self:
@@ -7,13 +7,33 @@ class YuthonDutySummary(models.Model):
employee_id = fields.Many2one('hr.employee', string='员工')
duty_weekdays = fields.Float(string='周一至周五值班次数')
subtotal_weekdays = fields.Float(string='小计')
subtotal_weekdays = fields.Float(string='小计', compute='_compute_subtotal_weekdays')
duty_weekends = fields.Float(string='周六日值班次数(不调休)')
subtotal_weekends = fields.Float(string='小计')
subtotal_weekends = fields.Float(string='小计', compute='_compute_subtotal_weekends')
duty_weekends_leave = fields.Float(string='周六日值班次数(调休)')
subtotal_weekends_leave = fields.Float(string='小计')
total_duty_shifts = fields.Float(string='值班合计')
total_duty_shifts = fields.Float(string='值班合计', compute='_compute_total_duty_shifts')
holidays = fields.Float(string='节假日值班费(元)')
total = fields.Float(string='总合计')
total = fields.Float(string='总合计', compute='_compute_total')
remake = fields.Text(string='备注')
duty_arrangement_id = fields.Many2one('yuthon.duty.arrangement', string='关联值班安排')
duty_arrangement_id = fields.Many2one('yuthon.duty.arrangement', string='关联值班安排')
@api.depends('subtotal_weekdays', 'subtotal_weekends', 'subtotal_weekends_leave')
def _compute_total_duty_shifts(self):
for record in self:
record.total_duty_shifts = record.subtotal_weekdays + record.subtotal_weekends + record.subtotal_weekends_leave
@api.depends('duty_weekdays')
def _compute_subtotal_weekdays(self):
for record in self:
record.subtotal_weekdays = record.duty_weekdays * 60
@api.depends('duty_weekends')
def _compute_subtotal_weekends(self):
for record in self:
record.subtotal_weekends = record.duty_weekends * 160
@api.depends('subtotal_weekdays', 'subtotal_weekends', 'subtotal_weekends_leave','holidays')
def _compute_total(self):
for record in self:
record.total = record.subtotal_weekdays + record.subtotal_weekends + record.subtotal_weekends_leave + record.holidays
@@ -15,3 +15,4 @@ 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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
15 access_yuthon_duty_arrangement yuthon.duty.arrangement model_yuthon_duty_arrangement base.group_user 1 1 1 1
16 access_yuthon_duty_setting yuthon.duty.setting model_yuthon_duty_setting base.group_user 1 1 1 1
17 access_yuthon_duty_arrangement_wizard yuthon.duty.arrangement.wizard model_yuthon_duty_arrangement_wizard base.group_user 1 1 1 1
18 access_yuthon_duty_summary_wizard yuthon.duty.summary.wizard model_yuthon_duty_summary_wizard base.group_user 1 1 1 1
@@ -14,7 +14,13 @@ class YuthonDutyArrangementWizard(models.TransientModel):
num_people = self.number_personnel
available_people = self.env['hr.employee'].search([('department_id.name', '=', '仓储组')])
selected_people = random.sample(available_people, num_people)
self.env['yuthon.duty.arrangement'].search([]).unlink()
today = date.today()
first_day_of_month = today.replace(day=1)
last_day_of_month = (today.replace(day=1) + timedelta(days=32)).replace(day=1) - timedelta(days=1)
self.env['yuthon.duty.arrangement'].search([
('start_time', '>=', first_day_of_month),
('start_time', '<=', last_day_of_month),
]).unlink()
today = date.today()
next_month = (today.replace(day=1) + timedelta(days=32)).replace(day=1)
current_date = today
@@ -1,5 +1,7 @@
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, tools, _
from datetime import datetime
from datetime import date, timedelta, datetime
class YuthonDutySummaryWizard(models.TransientModel):
_name = 'yuthon.duty.summary.wizard'
@@ -31,21 +33,4 @@ class YuthonDutySummaryWizard(models.TransientModel):
}
def confirm(self):
employees = self.env['hr.employee'].search([])
for employee in employees:
duty_arrangements = self.env['yuthon.duty.arrangement'].search([
('employee_id', '=', employee.id),
])
weekday_count = 0
weekend_count = 0
for arrangement in duty_arrangements:
if 0 <= arrangement.start_time.weekday() <= 4:
weekday_count += 1
elif arrangement.start_time.weekday() in (5, 6):
weekend_count += 1
summary = self.env['yuthon.duty.summary'].search([
('employee_id', '=', employee.id),
], limit=1)
if summary:
summary.duty_weekdays = weekday_count
summary.duty_weekends = weekend_count
pass
@@ -15,11 +15,11 @@
</form>
</field>
</record>
<!-- <record id="yuthon_duty_summary_wizard_action" model="ir.actions.server">-->
<!-- <field name="name">值班汇总计算</field>-->
<!-- <field name="model_id" ref="yuthon_hr_attendance.yuthon_duty_summary_wizard"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">action = model.action_duty_summary_wizard()-->
<!-- </field>-->
<!-- </record>-->
</odoo>
<record id="yuthon_duty_summary_wizard_action" model="ir.actions.server">
<field name="name">值班汇总计算</field>
<field name="model_id" ref="yuthon_hr_attendance.model_yuthon_duty_summary_wizard"/>
<field name="state">code</field>
<field name="code">action = model.action_duty_summary_wizard()
</field>
</record>
</odoo>
+1 -1
View File
@@ -14,7 +14,7 @@ class HrJob(models.Model):
number = fields.Char(string="序号")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建'),('thtjbb', '天河投资本部')], string="所属公司")
('thlc', '天河粮储'), ('thtjbb', '天河投资本部')], string="所属公司")
job_type_id = fields.Many2one('hr.job.type', string="岗位类别")
job_lv_id = fields.Many2one('yuthon.job.lv', string="职级")
start_date = fields.Date(string="生效日期", default=lambda self: fields.Date.today())
@@ -33,8 +33,7 @@ class YuthonHrEmployee(models.Model):
job_lv_id = fields.Many2one('yuthon.job.lv', string="最新职级")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')],
default='thtz', store=True, compute="compute_company", string="所属公司")
('thlc', '天河粮储')], default='thtz', store=True, compute="compute_company", string="所属公司")
# 个人信息
user_salary = fields.Float(string="基本工资")
job_lv_salary = fields.Float(string="职级工资")
@@ -117,7 +116,6 @@ class YuthonHrEmployee(models.Model):
company_mapping = {'天河投资集团': 'thtz',
'天河物管': 'thwg',
'天河粮储': 'thlc',
'天投城建': 'tctj',
'天河投资本部': 'thtjbb'}
for record in self:
visited_departments = set()
+1 -1
View File
@@ -22,7 +22,7 @@ class YuthonJobLv(models.Model):
all_wage = fields.Float(string="应发工资", group_operator=None)
comprehensive_subsidy = fields.Float(string="综合补贴", group_operator=None)
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
('thlc', '天河粮储')], string="所属公司")
create_time = fields.Datetime(string="生效日期", default=fields.Datetime.now)
end_time = fields.Datetime(string="失效日期")
@@ -18,7 +18,7 @@ class YuthonInterviewApproval(models.Model):
applicant_ids = fields.One2many('interview.approval.line', 'interview_approval_id', string='应聘面试信息')
is_issues = fields.Boolean(string='是否上会')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="公司")
('thlc', '天河粮储')], string="公司")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
def scheduling_of_meetings(self):
@@ -13,7 +13,7 @@ class YuthonLeavingApproval(models.Model):
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_leaving_approval_code'))
phone = fields.Char(related='users_id.employee_id.work_phone',string='手机号')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="任职单位")
('thlc', '天河粮储')], string="任职单位")
job_id = fields.Many2one(related='users_id.employee_id.job_id', string="主岗")
duties = fields.Char(string="职务")
@@ -27,7 +27,7 @@ class YuthonOnboardApproval(models.Model):
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="部门")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="甲方")
('thlc', '天河粮储')], string="甲方")
grades_id = fields.Many2one('yuthon.job.lv', string='职级')
account = fields.Char(string='账号')
bank = fields.Char(string='开户行')
@@ -10,7 +10,7 @@ class YuthonPrepareApproval(models.Model):
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="部门")
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_prepare_approval_code'))
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string="所属公司")
name = fields.Char(string='标题')
reason = fields.Html(string="正文")
is_issues = fields.Boolean(string='是否上会')
@@ -82,7 +82,7 @@ class PrepareApprovalLine(models.Model):
hr_job_id = fields.Many2one('hr.job', string='工作岗位')
department_id = fields.Many2one("hr.department", string="部门")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
('thlc', '天河粮储')], string="所属公司")
job_type_id = fields.Many2one('hr.job.type', string="岗位类型")
compiling_external = fields.Integer(string="编制外人数")
job_lv_id = fields.Many2one('yuthon.job.lv', string="职级")
@@ -139,7 +139,7 @@ class NewPrepareApprovalLine(models.Model):
hr_job_id = fields.Many2one('hr.job', string='工作岗位')
department_id = fields.Many2one("hr.department", string="部门")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
('thlc', '天河粮储')], string="所属公司")
job_type_id = fields.Many2one('hr.job.type', string="岗位类型")
compiling_external = fields.Integer(string="编制外人数")
job_lv_id = fields.Many2one('yuthon.job.lv', string="职级")
@@ -13,7 +13,7 @@ class YuthonReassignmentApproval(models.Model):
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_reassignment_approval_code'))
phone = fields.Char(related='users_id.employee_id.work_phone',string='联系电话')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="任职单位")
('thlc', '天河粮储')], string="任职单位")
job_id = fields.Many2one(related='users_id.employee_id.job_id', string="主岗")
duties = fields.Char(string="职务")
job_lv_id = fields.Many2one(related='users_id.employee_id.job_lv_id', string='职级')
@@ -19,7 +19,7 @@ class YuthonRecruitmentApproval(models.Model):
notice_documents_ids = fields.Many2many('ir.attachment', string='议题附件')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
('thlc', '天河粮储')], string="所属公司")
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
@api.onchange('is_issues')
@@ -15,7 +15,7 @@ class YuthonRegularizationPrepareApproval(models.Model):
phone = fields.Char(string='手机号')
job = fields.Char(string="职务")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="任职单位")
('thlc', '天河粮储')], string="任职单位")
job_type_id = fields.Many2one('hr.job.type', string="岗位类别")
job_lv_id = fields.Many2one(related='users_id.employee_id.job_lv_id', string='职级')
onboarding_time = fields.Date(related='users_id.employee_id.entry_date',string="入职日期")
@@ -13,7 +13,7 @@ class YuthonRewardApproval(models.Model):
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_salary_approval_code'))
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
('thlc', '天河粮储')], string="所属公司")
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="部门")
entrant_date = fields.Date(string="录入日期")
@@ -14,7 +14,7 @@ class YutransferApproval(models.Model):
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="部门")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
('thlc', '天河粮储')], string="所属公司")
main_post = fields.Many2one("hr.job", string="主岗")
duties = fields.Char(string="职务")
grades = fields.Many2one('yuthon.job.lv', string='职级')
+1 -1
View File
@@ -15,7 +15,7 @@ class IssueApproval(models.Model):
employee_id = fields.Many2one('hr.employee', string="经办人", default=lambda self: self.env.user.employee_id)
department_id = fields.Many2one(related='employee_id.department_id', string="部门")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储'),
('tctj', '天投城建'), ('thtjbb', '天河投资本部')],
('thtjbb', '天河投资本部')],
related='employee_id.yuthon_company', string="所属公司")
user_id = fields.Many2one('res.users', string="经办人", default=lambda self: self.env.user)
meeting_details = fields.Char(string="会议详情")
@@ -16,7 +16,7 @@ class IssueApprovalDecision(models.Model):
board_meet = fields.Selection([('approval', '审'), ('decide', '决'), ('commission', '授权投决会')], string='董事会', compute='_compute_board_meet', readonly=False)
district_bureau = fields.Selection([('record', '备案'), ('approved', '核准'), ('record_approved', '备案、核准')], string='上级单位')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司")
('thlc', '天河粮储')], string="所属公司")
department_id = fields.Many2one('hr.department', string="部门")
start_date = fields.Date(string="生效日期")
end_date = fields.Date(string="失效日期")
+1 -1
View File
@@ -37,7 +37,7 @@ class IssueLibrary(models.Model):
employee_id = fields.Many2one('hr.employee', string='创建人', default=lambda self: self.env.user.employee_id)
department_id = fields.Many2one('hr.department', string='部门', related='employee_id.department_id')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储'), ('tctj', '天投城建')], string="所属公司", related='employee_id.yuthon_company')
('thlc', '天河粮储')], string="所属公司", related='employee_id.yuthon_company')
users_role_ids = fields.Many2many('soong.user.role', string='角色范围', related='employee_id.user_role_ids')
approval_name = fields.Char(string="审批标题")
meeting_place = fields.Char(string="会议地点")
+2 -1
View File
@@ -14,7 +14,8 @@
'views/all_menu.xml'
],
'demo': [],
'depends': ['hr','mail', 'base', 'survey', 'soong_workflow', 'yuthon_wechat', 'documents','yuthon_property_approval'],
'depends': ['hr', 'mail', 'base', 'survey', 'soong_workflow',
'yuthon_wechat', 'documents', 'yuthon_property_approval'],
'installable': True,
'application': True,
}
@@ -108,17 +108,6 @@ class YuthonLesseeNotice(models.Model):
data = "您有新的通知公告请及时确认\n" + "<a href=\"{}\">{}</a>".format(str, self.name)
we_id = self.env['hr.employee'].search([('id', '=', user)]).wecom_userid
self.sudo().env["wecom.apps"].sync_send_message(we_id, data)
# # 待办关联
# self.env['project.task'].create({
# 'name': '新的通知公告' + self.name + "请及时确认",
# 'user_ids': [(4, user)],
# 'notice_origin_id': self.id,
# })
# 普通用户权限是否打开,可能需要配置权限
# 关联待办和不关联待办
# partner_ids = self.sudo().env['res.users'].search([('id', 'in', publish_user_list)]).mapped('partner_id').ids
# self.sudo().with_context(lang=self.env.lang)._message_auto_subscribe_notify(partner_ids, 'yuthon_notice.message_yuthon_confirm_users_data')
self.write({"notice_state": 'yes'})
def look_up_notice_users(self):
@@ -11,8 +11,8 @@
<field name="department_id" column_invisible="1"/>
<field name="company_page" column_invisible="1"/>
<field name="create_date"/>
<field name="start_date" />
<field name="end_date" />
<field name="start_date"/>
<field name="end_date"/>
<field name="is_notice_roger" string="状态"/>
<button name="on_sequence" string="置顶" invisible="sequence != 0" type="object" class="btn-primary"/>
<button name="no_sequence" string="取消置顶" invisible="sequence != 1" type="object"
@@ -30,22 +30,22 @@
<field name="arch" type="xml">
<form string="公告管理">
<header>
<button name="notice_publish" string="发布" type="object" class="btn-primary"/>
<button name="notice_publish" string="发布" type="object" class="btn-primary"/>
</header>
<sheet>
<group col="3">
<group>
<field name="company_page" string="发布公司"/>
<field name="notice_type_id"/>
</group>
<group>
<field name="department_id" string="发布部门"/>
<field name="create_date"/>
</group>
<group>
<field name="user_id" required="1"/>
<field name="is_notice_roger"/>
</group>
<group>
<field name="company_page" string="发布公司"/>
<field name="notice_type_id"/>
</group>
<group>
<field name="department_id" string="发布部门"/>
<field name="create_date"/>
</group>
<group>
<field name="user_id" required="1"/>
<field name="is_notice_roger"/>
</group>
</group>
<group>
<field name="name"/>
@@ -54,15 +54,15 @@
</group>
<group col="3">
<group>
<field name="department_ids" widget="many2many_tags"/>
<field name="department_ids" widget="many2many_tags"/>
<field name="is_change_notice"/>
</group>
<group>
<field name="employee_ids" widget="many2many_tags"/>
<field name="employee_ids" widget="many2many_tags"/>
<field name="is_sticky"/>
</group>
<group>
<field name="users_role_ids" widget="many2many_tags"/>
<field name="users_role_ids" widget="many2many_tags"/>
</group>
</group>
</sheet>
@@ -100,7 +100,7 @@
<field name="model">yuthon.lessee.notice</field>
<field name="arch" type="xml">
<tree string="公告管理" create="false" edit="false" delete="false">
<field name="user_id" string="发布人"/>
<field name="user_id" string="发布人"/>
<field name="notice_type_id" string="类型"/>
<field name="name"/>
<field name="department_id" column_invisible="1"/>
@@ -129,7 +129,7 @@
</group>
<group>
<field name="department_ids" widget="many2many_tags"/>
<field name="employee_ids" widget="many2many_tags"/>
<field name="employee_ids" widget="many2many_tags"/>
</group>
<group>
<field name="read_number"/>
+13 -13
View File
@@ -7,17 +7,17 @@
<field name="padding">3</field>
</record>
<!-- <template id="message_yuthon_confirm_users_data">-->
<!-- <p style="margin: 0px;">-->
<!-- <span>尊敬的用户,</span><br />-->
<!-- <span style="margin-top: 8px;">您有一条新的公告确认请求-->
<!-- <t t-esc="object.name"/> 请登录系统查看详情。-->
<!-- </span>-->
<!-- </p>-->
<!-- <p style="margin-top: 24px; margin-bottom: 16px;">-->
<!-- <a t-att-href="access_link" t-att-data-oe-model="object._name" t-att-data-oe-id="object.id" style="background-color:#2C65F7; padding: 10px; text-decoration: none; color: #fff; border-radius: 5px;">-->
<!-- 查看 <t t-esc="model_description or 'document'"/>-->
<!-- </a>-->
<!-- </p>-->
<!-- </template>-->
<template id="message_yuthon_confirm_users_data">
<p style="margin: 0px;">
<span>尊敬的用户,</span><br />
<span style="margin-top: 8px;">您有一条新的公告确认请求
<t t-esc="object.name"/> 请登录系统查看详情。
</span>
</p>
<p style="margin-top: 24px; margin-bottom: 16px;">
<a t-att-href="access_link" t-att-data-oe-model="object._name" t-att-data-oe-id="object.id" style="background-color:#2C65F7; padding: 10px; text-decoration: none; color: #fff; border-radius: 5px;">
查看 <t t-esc="model_description or 'document'"/>
</a>
</p>
</template>
</odoo>
+10 -6
View File
@@ -6,7 +6,7 @@ from odoo.exceptions import ValidationError, UserError
class YuthonNotice(models.Model):
_name = "yuthon.notice"
_description = '通知公告'
_inherit = ['soong.workflow.mixin']
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin']
_rec_name = 'name'
_order = "sequence desc"
@@ -21,7 +21,8 @@ class YuthonNotice(models.Model):
end_date = fields.Date(string="终止日期")
sequence = fields.Integer(string="顺序", default=1, compute='_compute_sequence')
employee_ids = fields.Many2many('hr.employee', string="人员范围")
notice_state = fields.Selection([('no', '未发布'), ('yes', '已发布'), ('stop', '已终止')], default='no', string="公告状态")
notice_state = fields.Selection([('no', '未发布'), ('yes', '已发布'), ('stop', '已终止')], default='no',
string="公告状态")
notice_documents_ids = fields.Many2many('documents.document', string="附件")
is_notice_roger = fields.Selection([('yes', '已读'), ('no', '未读')], default='no', string="确认状态")
is_change_notice = fields.Boolean(string="是否发送通知", default=True)
@@ -34,7 +35,8 @@ class YuthonNotice(models.Model):
@api.depends('read_number')
def _compute_read_number(self):
notice_confirm_ids = self.env['yuthon.confirm.users'].search([('notice_id.id', '=', self.id), ('state', '=', 'yes')])
notice_confirm_ids = self.env['yuthon.confirm.users'].search(
[('notice_id.id', '=', self.id), ('state', '=', 'yes')])
for read in self:
if notice_confirm_ids:
read.read_number = len(notice_confirm_ids)
@@ -43,7 +45,8 @@ class YuthonNotice(models.Model):
@api.onchange('is_notice_roger')
def onchange_is_notice_roger(self):
roger_id = self.env['yuthon.confirm.users'].search([('notice_id', '=', self.id), ('employee_id', '=', self.env.user.employee_id.id)])
roger_id = self.env['yuthon.confirm.users'].search(
[('notice_id', '=', self.id), ('employee_id', '=', self.env.user.employee_id.id)])
if not roger_id:
self.is_notice_roger = 'yes'
@@ -78,9 +81,10 @@ class YuthonNotice(models.Model):
'state': 'no',
})
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', user_id=we_id,
title="通知公告",
description=self.name,
title="通知公告", description=self.name,
url=str, btntxt="详细信息")
# partner_ids = self.sudo().env['res.users'].search([('id', 'in', employee_users_list)]).mapped('partner_id').ids
# self.sudo().with_context(lang=self.env.lang)._message_auto_subscribe_notify(partner_ids, 'yuthon_notice.message_yuthon_confirm_users_data')
self.write({"notice_state": 'yes'})
def look_up_notice_users(self):
@@ -32,4 +32,23 @@ class YuthonOfficialIncomingParty(models.Model):
string="状态", default='drft')
deadline = fields.Date(string="办理期限")
red_suit = fields.Char(string="套红")
official_documents_ids = fields.Many2many('documents.document', string="公文相关文件")
official_documents_ids = fields.Many2many('documents.document', string="附件")
is_issues = fields.Boolean(string="是否上会")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
@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("已经创建了相关的上会记录,不能取消勾选")
@@ -32,4 +32,23 @@ class YuthonOfficialIncomingLabor(models.Model):
string="状态", default='drft')
deadline = fields.Date(string="办理期限")
red_suit = fields.Char(string="套红")
official_documents_ids = fields.Many2many('documents.document', string="公文相关文件")
official_documents_ids = fields.Many2many('documents.document', string="附件")
is_issues = fields.Boolean(string="是否上会")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
@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("已经创建了相关的上会记录,不能取消勾选")
@@ -11,8 +11,7 @@ class YuthonOfficialIncomingNormal(models.Model):
name = fields.Char(string="标题")
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('official_code'))
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储'),
('tctj', '天投城建')], string='公司')
yuthon_company = fields.Selection(related='users_id.employee_id.yuthon_company', string="公司")
official_type_id = fields.Many2one('official.type', string="公文种类")
reference_cold = fields.Integer(string="来文字号")
reference_date = fields.Date(string='来问日期')
@@ -76,7 +75,6 @@ class YuthonOfficialIncomingNormal(models.Model):
'default_incoming_normal_id': self.id,
},
}
# def button_meet(self):
# return {
# "name": "会议",
@@ -22,20 +22,20 @@
<field name="statu" widget="statusbar"/>
</header>
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" required="1"/>
</h1>
</div>
<group>
<group string="审批事项">
<field name="name" required="1"/>
<field name="main_text" widget="tinymce"/>
<field name="official_documents_ids" widget="many2many_tags"/>
</group>
<group string="收文信息">
<group>
<field name="code"/>
<field name="reference_cold"/>
<field name="major_event_category"/>
<field name="urgency"/>
<field name="secret_level"/>
<field name="date"/>
<field name="is_issues"/>
<field name="related_issues_id" invisible="not is_issues"/>
</group>
<group>
<field name="department_id"/>
@@ -43,25 +43,13 @@
<field name="copy_flats"/>
<field name="servings_number"/>
<field name="deadline"/>
<field name="official_documents_ids">
<tree>
<field name="name"/>
</tree>
</field>
<field name="date"/>
</group>
</group>
<group>
<field name="main_text" widget="tinymce"/>
<field name="remarks"/>
</group>
</sheet>
<div class="o_attachment_preview"/>
<div class="oe_chatter">
<field name="message_follower_ids" groups="base.group_user"/>
<field name="activity_ids"/>
<field name="message_ids"/>
<field name="red_suit"/>
</div>
</form>
</field>
</record>
@@ -17,6 +17,11 @@
<field name="arch" type="xml">
<form>
<sheet>
<group string="审批事项">
<field name="name" required="1"/>
<field name="main_text"/>
<field name="official_documents_ids" widget="many2many_tags"/>
</group>
<group string="行政信息">
<group col="2">
<field name="reference_cold"/>
@@ -43,11 +48,6 @@
<field name="remarks"/>
</group>
</group>
<group string="审批事项">
<field name="name" required="1"/>
<field name="main_text"/>
<field name="official_documents_ids" widget="many2many_tags"/>
</group>
<notebook>
<page string="督办事项" invisible="not is_supervising">
<field name="workflow_inspector_ids"/>
@@ -12,7 +12,6 @@
</tree>
</field>
</record>
<record id="yuthon_official_incoming_party_form" model="ir.ui.view">
<field name="name">yuthon.official.incoming.party.form</field>
<field name="model">yuthon.official.incoming.party</field>
@@ -22,46 +21,34 @@
<field name="statu" widget="statusbar"/>
</header>
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" required="1"/>
</h1>
</div>
<group>
<group string="审批事项">
<field name="name" required="1"/>
<field name="main_text"/>
<field name="official_documents_ids" widget="many2many_tags"/>
</group>
<group string="收文信息">
<group>
<field name="code"/>
<field name="reference_cold"/>
<field name="major_event_category"/>
<field name="urgency"/>
<field name="secret_level"/>
<field name="date"/>
<field name="is_issues"/>
<field name="related_issues_id" invisible="not is_issues"/>
</group>
<group>
<field name="date"/>
<field name="department_id"/>
<field name="main_flats"/>
<field name="copy_flats"/>
<field name="servings_number"/>
<field name="deadline"/>
<field name="official_documents_ids">
<tree>
<field name="name"/>
</tree>
</field>
</group>
</group>
<group>
<field name="main_text" widget="tinymce"/>
<field name="remarks"/>
</group>
</sheet>
<div class="o_attachment_preview"/>
<div class="oe_chatter">
<field name="message_follower_ids" groups="base.group_user"/>
<field name="activity_ids"/>
<field name="message_ids"/>
<field name="red_suit"/>
</div>
</form>
</field>
</record>
@@ -6,29 +6,29 @@ class YuthonIndexManagement(models.Model):
_description = "组织绩效标准库"
_rec_name = 'index_name'
dimension = fields.Char('维度', required=True)
development_goals = fields.Char('发展目标', required=True)
index_name = fields.Char('指标名称', required=True)
index_definition = fields.Text('指标定义', required=True)
sequence = fields.Char(string='序号', store=True)
dimension = fields.Char('维度')
development_goals = fields.Char('发展目标')
index_name = fields.Char('指标名称')
index_definition = fields.Text('指标定义')
index_type = fields.Selection([('kpi', 'KPI'),
('gs', 'GS')],'指标类别')
index_compute = fields.Char('指标计算公式', required=True)
('gs', 'GS'), ('no', '否决指标')],'指标类别')
index_compute = fields.Char('指标计算公式')
compute_type = fields.Selection([('bad_index', '反向指标'),
('good_index', '正向指标'),
('two_index', '双向指标'),],'计算类别')
check_norm = fields.Char('考核标准', required=True)
department_ids = fields.Many2many("hr.department", string="指标来源", required=True)
check_norm = fields.Text('考核标准')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
('thlc', '天河粮储')], string="所属公司")
department_ids = fields.Many2many("hr.department", string="指标来源")
in_charge_role_ids = fields.Many2many('soong.user.role', string='角色')
employee_id = fields.Many2one('hr.employee', string="人员")
start_index_time = fields.Date(string='生效时间', required=True)
start_index_time = fields.Date(string='生效时间', default=fields.Date.today())
end_index_time = fields.Date(string='失效时间')
unit_compute = fields.Char('计算单位')
weight = fields.Char(string="权重%")
compute_method = fields.Char(string="计算方法")
compute_act = fields.Char(string="计划安排及具体措施/行动")
change_index_library_id = fields.Many2one("yuthon.index.approval", string="指标库变更明细")
index_duty_id = fields.Many2one('yuthon.duty.management', string="绩效明细")
index_duty_approval_id = fields.Many2one('yuthon.duty.approval', string="部门责任变更明细")
@@ -10,6 +10,7 @@
<button name="put_adjustment_approval" type="object" string="提交组织指标变更申请"/>
<button name="put_assessment_tasks_approval" type="object" string="提交考核任务"/>
</header>
<field name="sequence"/>
<field name="dimension"/>
<field name="development_goals"/>
<field name="index_name"/>
@@ -23,6 +24,7 @@
<field name="employee_id"/>
<field name="start_index_time"/>
<field name="end_index_time"/>
<field name="yuthon_company"/>
</tree>
</field>
</record>
@@ -40,12 +42,13 @@
</div>
<group col="4">
<group>
<field name="sequence"/>
<field name="dimension"/>
<field name="development_goals"/>
<field name="index_type"/>
<field name="index_definition"/>
</group>
<group>
<field name="index_type"/>
<field name="compute_type"/>
<field name="check_norm"/>
<field name="department_ids" widget="many2many_tags"/>
@@ -54,6 +57,7 @@
<field name="in_charge_role_ids" widget="many2many_tags"/>
<field name="employee_id"/>
<field name="start_index_time"/>
<field name="yuthon_company"/>
</group>
<group>
<field name="end_index_time"/>
@@ -64,11 +68,23 @@
</form>
</field>
</record>
<record id="yuthon_index_management_search" model="ir.ui.view">
<field name="name">yuthon.index.management.search</field>
<field name="model">yuthon.index.management</field>
<field name="arch" type="xml">
<search>
<group expand="1">
<filter name="group_development_goals" string="发展目标" context="{'group_by': 'development_goals'}"/>
</group>
</search>
</field>
</record>
<!-- Action-->
<record id="yuthon_index_management_action" model="ir.actions.act_window">
<field name="name">组织绩效</field>
<field name="res_model">yuthon.index.management</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,search</field>
<field name="context">{'search_default_group_development_goals': 1}</field>
</record>
</odoo>
+2 -2
View File
@@ -43,7 +43,7 @@ class YuthonProperty(models.Model):
('signed', '已备案'), ('leased', '已出租'), ('idle', '闲置')], string='状态', default='to')
is_meter = fields.Boolean(string="是否有水表")
is_electricity_meter = fields.Boolean(string="是否有电表")
yuthon_company = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储'), ('tj', '天河投建')],
yuthon_company = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储'),],
string="所属公司")
admin_id = fields.Many2one('res.users', string="管理员")
purpose_id = fields.Many2one('yuthon.resource.purpose', string="资产用途")
@@ -305,7 +305,7 @@ class ManageInformationLine(models.Model):
purpose_id = fields.Many2one('yuthon.resource.purpose', string="资产用途")
precinct = fields.Char(string="片区")
admin_id = fields.Many2one('res.users', string="管理员")
yuthon_company = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储'), ('tj', '天河投建')],
yuthon_company = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储'),],
string="所属公司")
start_time = fields.Date(string="生效日期")
end_date = fields.Date(string="失效日期")
@@ -17,8 +17,7 @@ class PropertyEligibility(models.Model):
eligibility_ids = fields.One2many('property.eligibility.line', 'eligibility_id', string="意向客户明细")
sincerity_gold = fields.Float(string="诚意金")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储'),
('tctj', '天投城建')], string='公司')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], 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="关联议题")
@@ -12,8 +12,7 @@ class PropertyIntentionApproval(models.Model):
name = fields.Char(string="标题")
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_intention_code'))
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储'),
('tctj', '天投城建')], string='公司')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], 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="关联议题")
@@ -13,8 +13,7 @@ class PropertyTransferApproval(models.Model):
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('property_transfer_code'))
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储'),
('tctj', '天投城建')], string='公司')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], 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="关联议题")
@@ -8,8 +8,7 @@ class HrPayrollStructure(models.Model):
lv = fields.Char(string="级别")
name = fields.Char(string="职级名称")
sequence = fields.Char(string='级别序号', store=True)
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储'),
('tctj', '天投城建')], string='所属公司')
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')], string='所属公司')
create_time = fields.Datetime(string="生效日期", default=fields.Datetime.now)
end_time = fields.Datetime(string="失效日期")
type_id = fields.Many2one('hr.payroll.structure.type', string="岗位类别",required=False)
+19 -6
View File
@@ -1,6 +1,6 @@
from odoo import api, fields, models, modules
import datetime
from datetime import datetime, timedelta
from datetime import datetime, timedelta, time
class YuthonWillTask(models.Model):
@@ -17,8 +17,8 @@ class YuthonWillTask(models.Model):
employee_ids = fields.Many2many('hr.employee', string='人员', default=lambda self: self.env.user.employee_id)
remind = fields.Selection([('fifteen', '提醒-15分钟'), ('thirty', '提醒-30分钟'), ('one_hour', '提醒-1小时'),
('two_hour', '提醒-2小时'), ('one_day', '提醒-1天')], string='提醒')
start_time = fields.Datetime(string='开始时间')
end_time = fields.Datetime(string='结束时间')
start_time = fields.Datetime(string='开始时间', default=fields.Date.today())
end_time = fields.Datetime(string='结束时间', default=lambda self: datetime.combine(datetime.now().date(), time(11, 0, 0)))
remind_mapping = {
'fifteen': timedelta(minutes=15),
@@ -40,7 +40,20 @@ class YuthonWillTask(models.Model):
if not self.wecom_userid:
raise ("请同步{}的企业微信".format(self.name))
for employee_id in self.employee_ids:
url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self.yuthon_will_task,employee_id.id)
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='attendance', user_id=self.wecom_userid,
url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self._name, self.id)
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='task', user_id=employee_id.wecom_userid,
title="待办事项", description="测试消息请忽略",
url=url, btntxt="详细信息")
url=url, btntxt="详细信息")
def button_add_comment(self):
self.ensure_one()
self.add_comment()
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'type': 'success',
'message': '已发送提醒消息',
'sticky': False,
}
}
@@ -17,6 +17,7 @@
<field name='creation_time' optional="hide"/>
<field name='remind'/>
<field name='remarks'/>
<button name="button_add_comment" string="提醒" type="object" class="oe_highlight"/>
</tree>
</field>
</record>
+5 -5
View File
@@ -77,11 +77,11 @@
parent="menu_hr_attendance_duty_summary_menu_board"
action="yuthon_hr_attendance.view_yuthon_duty_summary_action"
sequence="3"/>
<!-- <menuitem id="menu_hr_attendance_duty_summary_compute_board"-->
<!-- name="值班汇总计算"-->
<!-- parent="menu_hr_attendance_duty_summary_menu_board"-->
<!-- action="yuthon_hr_attendance.yuthon_duty_summary_wizard_action"-->
<!-- sequence="5"/>-->
<menuitem id="menu_hr_attendance_duty_summary_compute_board"
name="值班汇总计算"
parent="menu_hr_attendance_duty_summary_menu_board"
action="yuthon_hr_attendance.yuthon_duty_summary_wizard_action"
sequence="5"/>
<menuitem id="menu_adjustments_approval_board"
name="值班调休申请"
parent="menu_hr_attendance_duty_summary_menu_board"