diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index 00ef6ec58..8c3da2dec 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -649,7 +649,7 @@ class YuthonVacationReports(models.Model): ('vacation_date', '=', today) ], limit=1) - if not existing_record and not is_resource_user: + if not existing_record or not is_resource_user: # 仅查找已确认的上月记录 last_month_record = self.search([ ('employee_id', '=', employee.id), @@ -684,11 +684,12 @@ class YuthonVacationReports(models.Model): self._update_over_lines(new_report, [last_month_record], overtime_hours) else: - # 如果没有已确认的上月记录,创建空的本月报告 - self.create({ - 'employee_id': employee.id, - 'vacation_date': current_month_first, - }) + # 如果没有已确认的上月记录,创建空的本月报告 + self.create({ + 'employee_id': employee.id, + 'vacation_date': current_month_first, + }) + def _update_leave_lines(self, report, allocations, number_of_hours_display): for alloc in allocations: diff --git a/yuthon_maintain/models/processing_order_approval.py b/yuthon_maintain/models/processing_order_approval.py index 2d7d91109..6144785f1 100644 --- a/yuthon_maintain/models/processing_order_approval.py +++ b/yuthon_maintain/models/processing_order_approval.py @@ -34,6 +34,7 @@ class ProcessingOrderApproval(models.Model): repair_id = fields.Many2one('property.report.repair', string="报事报修(物业)") property_id = fields.Many2one('yuthon.property', string="物业") lessee_id = fields.Many2one('property.tenant.information', string="承租方") + contract_id = fields.Many2one('property.lease.contract', string="合同", compute='_compute_contract_id') contact = fields.Char(string="联系人") phone = fields.Char(string="联系电话") problem_description = fields.Text(string="问题描述") @@ -67,6 +68,14 @@ class ProcessingOrderApproval(models.Model): name_title = fields.Char(default=_get_default_name_title) + @api.depends('property_id') + def _compute_contract_id(self): + if self.property_id: + contract_id = self.env["property.lease.contract.line"].search([('address_id', '=', self.property_id.id)], limit=1) + else: + contract_id = False + self.contract_id = contract_id + @api.depends("company_id") def _compute_name(self): self.name = False diff --git a/yuthon_maintain/views/processing_order_approval_views.xml b/yuthon_maintain/views/processing_order_approval_views.xml index 5d05c838c..6b459fda9 100644 --- a/yuthon_maintain/views/processing_order_approval_views.xml +++ b/yuthon_maintain/views/processing_order_approval_views.xml @@ -54,6 +54,7 @@ + diff --git a/yuthon_property_approval/wizard/choose_property_wizard.py b/yuthon_property_approval/wizard/choose_property_wizard.py index 4106196df..3cdb74ad1 100644 --- a/yuthon_property_approval/wizard/choose_property_wizard.py +++ b/yuthon_property_approval/wizard/choose_property_wizard.py @@ -81,4 +81,5 @@ class ChoosePropertyWizard(models.Model): 'address_for_delivery': ','.join(all_names), 'total_area': sum([lease.property_area for lease in rec.lease_ids]) }) + self.lease_contract_id.onchange_lease_ids()