添加功能
This commit is contained in:
@@ -240,20 +240,18 @@ class SoongWorkflowRecord(models.Model):
|
||||
|
||||
@api.model
|
||||
def get_view(self, view_id=None, view_type='form', **options):
|
||||
"""在视图加载时检查当前用户是否在经办人列表中,并更新状态"""
|
||||
current_employee = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
|
||||
if current_employee:
|
||||
all_records = self.search([])
|
||||
# 更新当前用户经办的记录为"待办"
|
||||
user_records = all_records.search([
|
||||
('employee_ids', 'in', current_employee.id),
|
||||
])
|
||||
user_records.write({'soong_state': 'to_do'})
|
||||
|
||||
# 更新其他记录为"已办"
|
||||
other_records = all_records - user_records
|
||||
other_records.write({'soong_state': 'done'})
|
||||
|
||||
all_records = self.search([('employee_ids', 'in', current_employee.id)])
|
||||
for record in all_records:
|
||||
record_id = self.env[record.res_model].browse(record.res_id)
|
||||
if record_id:
|
||||
for log in record_id.log_ids:
|
||||
if log.done_by == self.env.user:
|
||||
if log.approval_state == 0:
|
||||
record.write({'soong_state': 'to_do'})
|
||||
else:
|
||||
record.write({'soong_state': 'done'})
|
||||
return super(SoongWorkflowRecord, self).get_view(view_id, view_type, **options)
|
||||
|
||||
# def get_department_employees(self, department_id):
|
||||
|
||||
@@ -620,13 +620,6 @@ class SoongWorkflowCommentWizard(models.TransientModel):
|
||||
elif hasattr(biz_record, 'users_id') and biz_record.users_id:
|
||||
employee = biz_record.users_id.employee_ids
|
||||
action_id = self.env['ir.actions.act_window'].search([('res_model', '=', self.res_model)])[0]
|
||||
# url = f'https://oa.thtzjt.com/web?login={employee.user_id.login}&oauth_uid={employee.wecom_userid}#id={record_id.id}&cids=2&action={action_id.id}&model={record_id._name}&view_type=form&menu_id=10104'
|
||||
# self.sudo().env["wecom.apps"].sync_send_message_textcard(category='oa',
|
||||
# user_id=employee.wecom_userid,
|
||||
# title=record_id._description,
|
||||
# description=f"编号为{record_id.code}的{record_id._description}已结束",
|
||||
# url=url, btntxt="查看详情")
|
||||
|
||||
recipients = []
|
||||
if self.node_btn_id.workflow_id.archive_type == 'applicant':
|
||||
biz_record = self.env[self.res_model].browse(self.res_id)
|
||||
|
||||
@@ -18,6 +18,22 @@ class YuthonVacationReports(models.Model):
|
||||
employee_id = fields.Many2one('hr.employee', string='员工')
|
||||
salary_group_id = fields.Many2one(related='employee_id.salary_group_id', string="工资单分组", store=True)
|
||||
department_id = fields.Many2one(related='employee_id.department_id', string="部门", store=True)
|
||||
open_start_time = fields.Date(related='employee_id.open_start_time',string="参加工作时间")
|
||||
years_of_service = fields.Integer(related='employee_id.job_id.years_of_service', string="工作年限")
|
||||
previous_year = fields.Float(string="上年剩余")
|
||||
valid_date = fields.Date(string="有效期至")
|
||||
year_distribution = fields.Float(string="本年发放")
|
||||
used_this_year = fields.Float(string="本年已用")
|
||||
remainder_year = fields.Float(string="本年剩余(年假)")
|
||||
last_holiday = fields.Float(string="上年公休日")
|
||||
last_workday = fields.Float(string="上年工作日")
|
||||
valid_date1 = fields.Date(string="有效期至")
|
||||
year_holiday = fields.Float(string="本年公休日")
|
||||
year_workday = fields.Float(string="本年工作日")
|
||||
year_sum = fields.Float(string="本年应休合计")
|
||||
used_this_year1 = fields.Float(string="本年已休")
|
||||
remainder_year1 = fields.Float(string="本年剩余(补休)")
|
||||
|
||||
company_id = fields.Many2one(related="employee_id.company_id", string="公司", store=True)
|
||||
late_allowed = fields.Float(related="employee_id.late_allowed", string="允许迟到次数")
|
||||
leave_ids = fields.One2many('vacation.leave.line', 'vacation_id', string='年假明细')
|
||||
|
||||
@@ -11,6 +11,21 @@
|
||||
<field name="department_id" column_invisible="1"/>
|
||||
<field name="company_id" column_invisible="1"/>
|
||||
<field name="vacation_date" column_invisible="1"/>
|
||||
<field name="open_start_time"/>
|
||||
<field name="years_of_service"/>
|
||||
<field name="previous_year"/>
|
||||
<field name="valid_date"/>
|
||||
<field name="year_distribution"/>
|
||||
<field name="used_this_year"/>
|
||||
<field name="remainder_year"/>
|
||||
<field name="last_holiday"/>
|
||||
<field name="last_workday"/>
|
||||
<field name="valid_date1"/>
|
||||
<field name="year_holiday"/>
|
||||
<field name="year_workday"/>
|
||||
<field name="year_sum"/>
|
||||
<field name="used_this_year1"/>
|
||||
<field name="remainder_year1"/>
|
||||
<field name="should_attendance" options='{ "fg_color": "white: should_attendance == False"}'/>
|
||||
<field name="actual_attendance" options='{ "fg_color": "white: actual_attendance == False"}'/>
|
||||
<field name="right_days" options='{ "fg_color": "white: right_days == False"}'/>
|
||||
|
||||
@@ -45,11 +45,18 @@ class PropertyStatementsWizard(models.Model):
|
||||
cleaned_amount = original_amount.replace(',', '')
|
||||
float_amount = float(cleaned_amount)
|
||||
your_own_unit = self.classify_by_last_four(your_own_account)
|
||||
if your_own_unit in ['天河投资', '天投城建']:
|
||||
company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1)
|
||||
elif your_own_unit in ['天河物管']:
|
||||
company_id = self.env['res.company'].search([('name', '=', '天河物管')], limit=1)
|
||||
elif your_own_unit in ['天河粮储']:
|
||||
company_id = self.env['res.company'].search([('name', '=', '天河粮储')], limit=1)
|
||||
sequence_number = row[5].value
|
||||
bank_data = {
|
||||
'name': name,
|
||||
'your_own_unit': your_own_unit,
|
||||
'original_amount': float_amount,
|
||||
'company_id': company_id.id,
|
||||
'sequence_number': sequence_number,
|
||||
'start_time': start_time - timedelta(hours=8),
|
||||
'your_own_account': your_own_account,
|
||||
@@ -81,11 +88,18 @@ class PropertyStatementsWizard(models.Model):
|
||||
extract = row[11].value
|
||||
serial_number = row[13].value
|
||||
your_own_unit = self.classify_by_last_four(your_own_account)
|
||||
if your_own_unit in ['天河投资', '天投城建']:
|
||||
company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1)
|
||||
elif your_own_unit in ['天河物管']:
|
||||
company_id = self.env['res.company'].search([('name', '=', '天河物管')], limit=1)
|
||||
elif your_own_unit in ['天河粮储']:
|
||||
company_id = self.env['res.company'].search([('name', '=', '天河粮储')], limit=1)
|
||||
bank_data = {
|
||||
'name': name,
|
||||
'serial_number': serial_number,
|
||||
'your_own_unit': your_own_unit,
|
||||
'no_amount': original_amount,
|
||||
'company_id': company_id.id,
|
||||
'bank_branch': bank_branch,
|
||||
'original_amount': original_amount,
|
||||
'start_time': start_time - timedelta(hours=8),
|
||||
@@ -124,10 +138,17 @@ class PropertyStatementsWizard(models.Model):
|
||||
serial_number = row[0].value
|
||||
lending_direction = lending_direction
|
||||
your_own_unit = self.classify_by_last_four(your_own_account)
|
||||
if your_own_unit in ['天河投资', '天投城建']:
|
||||
company_id = self.env['res.company'].search([('name', '=', '集团本部')], limit=1)
|
||||
elif your_own_unit in ['天河物管']:
|
||||
company_id = self.env['res.company'].search([('name', '=', '天河物管')], limit=1)
|
||||
elif your_own_unit in ['天河粮储']:
|
||||
company_id = self.env['res.company'].search([('name', '=', '天河粮储')], limit=1)
|
||||
bank_data = {
|
||||
'name': name,
|
||||
'serial_number': serial_number,
|
||||
'your_own_unit': your_own_unit,
|
||||
'company_id': company_id.id,
|
||||
'bank_branch': bank_branch,
|
||||
'no_amount': original_amount,
|
||||
'original_amount': original_amount,
|
||||
|
||||
Reference in New Issue
Block a user