diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index 3b34634c0..dca6c2d81 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -70,16 +70,23 @@ class HrAttendance(models.Model): # 补充假期橙色逻辑,班次逻辑 for emp in self.sudo().env['hr.employee'].search([]): test1 = att_ids.search([('current_data', '=', fields.Date.today()), ('employee_id', '=', emp.id)]) - if not test1: + resource_user_ids = emp.resource_calendar_id.resource_user_ids.ids + is_resource_user = True if emp.id in resource_user_ids else False + if not is_resource_user and not test1: + slot_start = datetime.combine(fields.Date.today(), datetime.min.time()) + slot_end = datetime.combine(fields.Date.today() + timedelta(days=1), datetime.min.time()) + # 查找员工对应的班次 + planning_slots = self.env['planning.slot'].search([ + ('employee_id', '=', emp.id), + ('start_datetime', '>=', slot_start), + ('start_datetime', '<', slot_end), + ], limit=1) att_ids.create({ 'employee_id': emp.id, + 'shift_id': planning_slots.id, 'current_data': fields.Date.today(), }) - - - - def state_fix(self): for att in self.env["hr.attendance"].browse(self._context.get('active_ids', self._context.get('active_id'))): att.write({'is_no_card': False, diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 8c3cbeadc..84f104fc2 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -251,6 +251,8 @@ class PropertyLeaseContract(models.Model): process_count = fields.Integer(string="流程数量", compute='_compute_process_count') is_issues = fields.Boolean(string='是否上会') + issues_result = fields.Html(string="会议结果") + related_issues_id = fields.Many2one('issue.library', string="关联议题") @api.onchange('is_issues') def _onchange_is_issues(self): @@ -272,24 +274,6 @@ class PropertyLeaseContract(models.Model): name_title = fields.Char(default=_get_default_name_title) contract_sort = fields.Selection([('property', '物业'), ('ads', '广告位'), ('guan', '管子间')], string="合同类型") - is_issues = fields.Boolean(string='是否上会') - issues_result = fields.Html(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(), - }) @api.depends('lease_ids.address_id.title_deed') def _compute_title_information(self): diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index 3a75733b2..6cb322f31 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -172,12 +172,12 @@ 付款方式 - + - + - + - + + + @@ -369,7 +371,8 @@ - + + - + - + - + - + + + diff --git a/yuthon_property_approval/wizard/choose_contract_wizard_views.xml b/yuthon_property_approval/wizard/choose_contract_wizard_views.xml index 70f3814df..300048043 100644 --- a/yuthon_property_approval/wizard/choose_contract_wizard_views.xml +++ b/yuthon_property_approval/wizard/choose_contract_wizard_views.xml @@ -9,7 +9,8 @@ - + + diff --git a/yuthon_property_approval/wizard/choose_property_wizard.py b/yuthon_property_approval/wizard/choose_property_wizard.py index e8cf3cb3e..477e643f8 100644 --- a/yuthon_property_approval/wizard/choose_property_wizard.py +++ b/yuthon_property_approval/wizard/choose_property_wizard.py @@ -15,8 +15,31 @@ class ChoosePropertyWizard(models.Model): property_ids = fields.Many2many( 'yuthon.property', string="物业信息", + domain="[('asset_type_id.name', '=', contract_sort_name)]" ) + contract_sort_name = fields.Char( + string="合同类型名称", + compute='_compute_contract_sort_name', + store=False + ) + + @api.depends('lease_contract_id.contract_sort') + def _compute_contract_sort_name(self): + type_mapping = { + 'property': '物业', + 'ads': '广告位', + 'guan': '管子间' + } + for rec in self: + if rec.lease_contract_id and rec.lease_contract_id.contract_sort: + rec.contract_sort_name = type_mapping.get( + rec.lease_contract_id.contract_sort, + '' + ) + else: + rec.contract_sort_name = '' + def confirm(self): rec = self.lease_contract_id lease_name = [] @@ -25,12 +48,6 @@ class ChoosePropertyWizard(models.Model): title_deed = [] title_address = [] for record in self.property_ids: - if self.property_ids[0].asset_type_id.name == '广告位': - contract_sort = 'ads' - elif self.property_ids[0].asset_type_id.name == '管子间': - contract_sort = 'guan' - else: - contract_sort = 'property' lease_name.append(record.name if record.name is not None else "") title_addr_name = record.title_address.name if (record.title_address and record.title_address.name) else "" title_address.append(title_addr_name) @@ -79,7 +96,6 @@ class ChoosePropertyWizard(models.Model): self.lease_contract_id.write({ 'tenure_type': self.lease_contract_id.lease_ids[0].address_id.tenure_type, - 'contract_sort': contract_sort, 'property_name': ','.join(all_names), 'title_address': ','.join(title_address_combined), 'lessor_id': self.lease_contract_id.lease_ids[0].address_id.company_id.id