@@ -2014,10 +2014,19 @@ class PropertyLeaseContract(models.Model):
|
||||
if self.admin_id:
|
||||
self.users_id = self.admin_id.user_id.id
|
||||
|
||||
@api.onchange("actual_start_time", "actual_end_time", "term_end_time")
|
||||
def _onchange_actual_start_time(self):
|
||||
for record in self:
|
||||
record.contract_time()
|
||||
|
||||
def get_property_contract_time(self):
|
||||
records_only_in_tree1 = self.env['property.lease.contract'].search([('state', '!=', 'settle')])
|
||||
for record in records_only_in_tree1:
|
||||
record.contract_time()
|
||||
|
||||
def contract_time(self):
|
||||
today = fields.Date.today()
|
||||
for contract in records_only_in_tree1:
|
||||
for contract in self:
|
||||
# 获取时间字段
|
||||
actual_start = contract.actual_start_time
|
||||
actual_end = contract.actual_end_time
|
||||
@@ -2032,7 +2041,6 @@ class PropertyLeaseContract(models.Model):
|
||||
else:
|
||||
# 如果不是最后一天,生效月份为当月
|
||||
effective_month = fields.Date.to_date(f"{actual_end.year}-{actual_end.month}-01")
|
||||
|
||||
# 根据时间条件更新状态
|
||||
if not actual_start or today < actual_start:
|
||||
# 待执行:实际开始时间未到或未设置
|
||||
|
||||
Reference in New Issue
Block a user