diff --git a/attendance_iot/__manifest__.py b/attendance_iot/__manifest__.py index 6d172bc95..b4823af7e 100644 --- a/attendance_iot/__manifest__.py +++ b/attendance_iot/__manifest__.py @@ -18,7 +18,7 @@ 'views/attendance_iot_user_views.xml', 'views/attendance_iot_manager_views.xml', 'views/attendance_iot_views.xml', - 'views/inherit_hr_employee_views.xml', + # 'views/inherit_hr_employee_views.xml', 'wizard/attendance_iot_manager_wizard_views.xml', ], 'installable': True, diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index ab33e285f..581c661f9 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -1145,11 +1145,9 @@ class HrAttendance(models.Model): attendance_ids = self.env["hr.attendance"].browse( self._context.get('active_ids', self._context.get('active_id'))) for attendance in attendance_ids: - if attendance.is_no_card: - attendance.absenteeism_card = True - attendance.is_abnormal = True + attendance.set_shift_name() - def _set_shift_name(self): + def set_shift_name(self): """抽取的统一班次名称设置逻辑""" for record in self: if record.shift_id: @@ -1193,7 +1191,7 @@ class HrAttendance(models.Model): # 检查是否为周末 weekday = record.current_data.isoweekday() - if weekday in [6, 7]: # 6=周六,7=周日 + if weekday in [6, 7]: is_weekend = True if is_shift_replacement: @@ -1203,7 +1201,11 @@ class HrAttendance(models.Model): else: record.shift_name = '行政班次' - record.is_week = is_weekend + if record.shift_name == "休息" and not is_holiday: + record.is_week = is_weekend + else: + record.is_week = False + record.is_holiday = is_holiday @api.model @@ -1215,14 +1217,14 @@ class HrAttendance(models.Model): today = fields.Date.today() if current_data > today: return record - record._set_shift_name() + record.set_shift_name() return record def write(self, vals): result = super(HrAttendance, self).write(vals) # 当更新考勤日期或班次时,重新计算班次名称 if 'current_data' in vals or 'shift_id' in vals: - self._set_shift_name() + self.set_shift_name() for record in self: self._update_vacation_report(record) return result diff --git a/yuthon_hr_attendance/models/yuthon_shift_approval.py b/yuthon_hr_attendance/models/yuthon_shift_approval.py index f2981d15f..734bf16a7 100644 --- a/yuthon_hr_attendance/models/yuthon_shift_approval.py +++ b/yuthon_hr_attendance/models/yuthon_shift_approval.py @@ -16,18 +16,18 @@ class YuthonShiftApproval(models.Model): transferees_id = fields.Many2one('resource.resource', string="调班对象", domain="[('id', 'in', resource_ids)]") alternate_id = fields.Many2one('resource.resource', string="替班对象", domain="[('id', 'in', resource_ids)]") alternate_shifts = fields.Selection([('transferees', '调班'), ('alternate', '替班')], string="调替班" , default='transferees') + shift_start = fields.Datetime(string="开始时间") + shift_end = fields.Datetime(string="结束时间") shift_id = fields.Many2one('planning.slot', string="申请人1") - shift_start = fields.Datetime(related='shift_id.start_datetime', string="开始时间") - shift_end = fields.Datetime(related='shift_id.end_datetime', string="结束时间") + shift_two_start = fields.Datetime(string="开始时间") + shift_two_end = fields.Datetime(string="结束时间") shift_two_id = fields.Many2one('planning.slot', string="申请人2") - shift_two_start = fields.Datetime(related='shift_two_id.start_datetime', string="开始时间") - shift_two_end = fields.Datetime(related='shift_two_id.end_datetime', string="结束时间") + return_start = fields.Datetime(string="开始时间") + return_end = fields.Datetime(string="结束时间") return_id = fields.Many2one('planning.slot', string="调班人1") - return_start = fields.Datetime(related='return_id.start_datetime', string="开始时间") - return_end = fields.Datetime(related='return_id.end_datetime', string="结束时间") + return_two_start = fields.Datetime(string="开始时间") + return_two_end = fields.Datetime(string="结束时间") return_two_id = fields.Many2one('planning.slot', string="调班人2") - return_two_start = fields.Datetime(related='return_two_id.start_datetime', string="开始时间") - return_two_end = fields.Datetime(related='return_two_id.end_datetime', string="结束时间") department_id = fields.Many2one('hr.department', string="部门", related='resource_id.employee_id.department_id') resource_ids = fields.Many2many('resource.resource', string="资源用户列表") is_issues = fields.Boolean(string='是否上会') diff --git a/yuthon_hr_attendance/views/hr_attendance_views.xml b/yuthon_hr_attendance/views/hr_attendance_views.xml index 3a2bee653..3aa6821b5 100644 --- a/yuthon_hr_attendance/views/hr_attendance_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_views.xml @@ -179,7 +179,7 @@ - 批量更新异常 + 批量更新班次名称 code diff --git a/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml b/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml index efdd37316..a651baeee 100644 --- a/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml +++ b/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml @@ -65,16 +65,6 @@ - - - - @@ -83,18 +73,18 @@ + + + + - - - - @@ -103,6 +93,16 @@ + + + + diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py index a8438a724..cfaadbf0f 100644 --- a/yuthon_hr_employee/models/yuthon_hr_employee.py +++ b/yuthon_hr_employee/models/yuthon_hr_employee.py @@ -337,7 +337,7 @@ class YuthonHrEmployee(models.Model): employee_id.late_allowed = 3 @api.onchange('user_role_id') - def _onchange_user_role_id(self): + def onchange_user_role_id(self): if self.user_role_id: user_id = self.env['soong.user.role'].search([('id', '=', self.user_role_id.id)]) user_id.write({'personnel_ids': [(4, self.id.origin)]}) @@ -605,10 +605,7 @@ class YuthonHrEmployee(models.Model): employee = self.env["hr.employee"].browse( self._context.get('active_ids', self._context.get('active_id'))) for employee_id in employee: - if employee_id.contract_id and employee_id.active == True: - employee_id.sudo().write({ - 'user_state': 'in' - }) + employee_id.onchange_user_role_id() @api.depends('confirmation_date') def _compute_regularization_year(self): diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml index b8ee4bb11..30a2c8a44 100644 --- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml @@ -638,13 +638,13 @@ - - - - - - - + + 更新员工主角色 + + + code + action = model.action_hr_state() + diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index d1a5debb4..9acf4358e 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -347,20 +347,12 @@ class PropertyLeaseContract(models.Model): ]) self.not_received = sum(record.submitted for record in not_reconciled_records) - def update_contract_sort(self): + def update_contract(self): contract_ids = self.env["property.lease.contract"].browse( self._context.get('active_ids', self._context.get('active_id'))) for rec in contract_ids: - if rec.lease_ids: - if rec.lease_ids[0].address_id.asset_type_id.name == '广告位': - contract_sort = 'ads' - elif rec.lease_ids[0].address_id.asset_type_id.name == '管子间': - contract_sort = 'guan' - else: - contract_sort = 'property' - else: - contract_sort = 'property' - rec.write({'contract_sort': contract_sort}) + rec.compute_expiration_coming() + def update_admin_id(self): contract_ids = self.env["property.lease.contract"].browse( @@ -618,23 +610,21 @@ class PropertyLeaseContract(models.Model): else: record.end_comparison = None - @api.depends('term_end_time', 'actual_end_time') - def _compute_expiration_coming(self): + @api.depends('actual_end_time') + def compute_expiration_coming(self): for record in self: - if record.term_end_time and record.actual_end_time: - if record.actual_end_time < record.term_end_time: - delta = record.term_end_time - record.actual_end_time - if 30< delta.days < 90: - record.expiration_coming = 'coming' - elif delta.days <=30: - record.expiration_coming = 'due' - else: - record.expiration_coming = None + if record.actual_end_time: + delta = record.actual_end_time - date.today() + if 0< delta.days < 90: + record.expiration_coming = 'coming' + elif delta.days <=0: + record.expiration_coming = 'due' else: record.expiration_coming = None else: record.expiration_coming = None + @api.onchange('total_area', 'rent') def _onchange_unit_price(self): for i in self: diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index ffc1550ec..d58c90464 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -800,7 +800,7 @@ - + @@ -947,12 +947,12 @@ code action = model.all_end_approval() - - 更新合同类型 + + 一次性 code - action = model.update_contract_sort() + action = model.update_contract() 调换 diff --git a/yuthon_trade/models/yuthon_contract_addition.py b/yuthon_trade/models/yuthon_contract_addition.py index 5754676f2..4c77250c6 100644 --- a/yuthon_trade/models/yuthon_contract_addition.py +++ b/yuthon_trade/models/yuthon_contract_addition.py @@ -20,7 +20,9 @@ class YuthonContractAddition(models.Model): issues_result = fields.Html(string="会议结果") related_issues_id = fields.Many2one('issue.library', string="关联议题") reason = fields.Text(string="正文") + workflow_id = fields.Many2one('soong.workflow.record', string="流程") document_ids = fields.Many2many('ir.attachment', string="附件") + active = fields.Boolean('Active', default=True, tracking=True) work_end = fields.Boolean(string="结束") diff --git a/yuthon_trade/views/yuthon_contract_addition_views.xml b/yuthon_trade/views/yuthon_contract_addition_views.xml index 3351629c5..f7996e911 100644 --- a/yuthon_trade/views/yuthon_contract_addition_views.xml +++ b/yuthon_trade/views/yuthon_contract_addition_views.xml @@ -45,6 +45,7 @@ +