Merge pull request !6169 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-11-04 03:45:20 +00:00
committed by Gitee
4 changed files with 18 additions and 6 deletions
@@ -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:
@@ -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
@@ -54,6 +54,7 @@
<group string="处理详情" col="2" invisible="not repair_id">
<group>
<field name="property_id"/>
<field name="contract_id"/>
<field name="lessee_id"/>
</group>
<group>
@@ -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()