-
+
+
diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py
index 1d000a9a0..326cde850 100644
--- a/yuthon_property_approval/models/inherit_yuthon_property.py
+++ b/yuthon_property_approval/models/inherit_yuthon_property.py
@@ -393,6 +393,7 @@ class PropertyAccountsReceivable(models.Model):
_rec_name = 'contract_id'
property_ids = fields.Many2many('yuthon.property', string='物业', compute='_compute_property_ids', store=True)
+ property_name = fields.Text(string='物业', compute="_compute_property_name")
management_area = fields.Float(related='contract_id.total_area', string='面积')
title_deed = fields.Char(string="产权证号", compute='_compute_title_deed')
lessee_id = fields.Many2one(related='contract_id.lessee_id', string='承租方')
@@ -407,6 +408,11 @@ class PropertyAccountsReceivable(models.Model):
rent_owed = fields.Float(string="欠租金额")
per_day = fields.Float(string="每天违约金(元/天)")
+ @api.depends('contract_id')
+ def _compute_property_name(self):
+ for record in self:
+ record.property_name = record.contract_id.property_name
+
@api.depends('property_ids')
def _compute_title_deed(self):
for record in self:
diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py
index 232e66a61..19f7c72f0 100644
--- a/yuthon_property_approval/models/property_lease_contract.py
+++ b/yuthon_property_approval/models/property_lease_contract.py
@@ -401,7 +401,10 @@ class PropertyLeaseContract(models.Model):
})
def end_approval(self):
- self.write({'condition': 'be_executed'})
+ self.write({'condition': 'be_executed',
+ 'actual_start_time': self.term_start_time,
+ 'actual_end_time': self.term_end_time,
+ })
def open_record(self):
return {
@@ -1506,6 +1509,36 @@ class PropertyLeaseContract(models.Model):
elif effective_month and today >= effective_month < term_end:
contract.contact_state = 'terminate'
+ @api.onchange('actual_start', 'actual_end')
+ def _onchange_contact_state(self):
+ for contract in self:
+ today = fields.Date.today()
+ term_end = contract.term_start_time
+ actual_start = contract.actual_start
+ actual_end = contract.actual_end
+ effective_month = None
+
+ if actual_end:
+ last_day_of_month = calendar.monthrange(actual_end.year, actual_end.month)[1]
+ if actual_end.day == last_day_of_month:
+ effective_month = fields.Date.to_date(f"{actual_end.year}-{actual_end.month}-{last_day_of_month}")
+ if effective_month.month == 12:
+ effective_month = fields.Date.to_date(f"{effective_month.year + 1}-01-01")
+ else:
+ effective_month = fields.Date.to_date(f"{effective_month.year}-{effective_month.month + 1}-01")
+ else:
+ effective_month = fields.Date.to_date(f"{actual_end.year}-{actual_end.month}-01")
+
+ if not actual_start or today < actual_start:
+ # 待执行:实际开始时间未到或未设置
+ contract.contact_state = 'to'
+ elif actual_start and (not actual_end or today < actual_end):
+ # 执行中:已开始且未结束(或结束时间未设置)
+ contract.contact_state = 'ing'
+ elif today >= actual_end == term_end:
+ contract.contact_state = 'complete'
+ elif effective_month and today >= effective_month and effective_month < term_end:
+ contract.contact_state = 'terminate'
# 续租
def button_lease_extension(self):
diff --git a/yuthon_property_approval/models/property_management.py b/yuthon_property_approval/models/property_management.py
index 27b8b05e8..5bd5889de 100644
--- a/yuthon_property_approval/models/property_management.py
+++ b/yuthon_property_approval/models/property_management.py
@@ -16,7 +16,8 @@ class PropertyManagement(models.Model):
default=lambda self: self.env['ir.sequence'].next_by_code('property_management_code'))
reason_change = fields.Char(string="变更事由")
user_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
- department_id = fields.Many2one('hr.department', related='user_id.employee_id.department_id',string="申请人部门")
+ department_id = fields.Many2one('hr.department', related='user_id.employee_id.department_id',string="申请人部门", store=True)
+ company_id = fields.Many2one('res.company', related='user_id..employee_id.company_id', string="公司", store=True)
handling_opinions = fields.Text(string="经办意见")
management_line2_ids = fields.One2many('property.management.line2', 'property_management_id', string="原物业信息")
management_line_ids = fields.One2many('property.management.line', 'property_management_id', string="物业信息")
diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
index e653d2563..0f3e0f81e 100644
--- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml
+++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml
@@ -276,7 +276,8 @@
-
+
+
diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard.py b/yuthon_property_approval/wizard/property_reconciliation_wizard.py
index 951b9e997..310da4de3 100644
--- a/yuthon_property_approval/wizard/property_reconciliation_wizard.py
+++ b/yuthon_property_approval/wizard/property_reconciliation_wizard.py
@@ -453,6 +453,7 @@ class PropertyReconciliationLine(models.Model):
reconciliation_id = fields.Many2one('property.reconciliation.wizard', string='关联对账单弹窗')
sequence = fields.Integer(string='顺序')
+ property_name = fields.Text(string='物业', compute="_compute_property_name")
property_ids = fields.Many2many('yuthon.property', string='物业', compute="_compute_property_ids", store=True)
contract_id = fields.Many2one('property.lease.contract', string='合同编号')
rent_month = fields.Float(string='当期金额')
@@ -464,6 +465,11 @@ class PropertyReconciliationLine(models.Model):
('other', '其他')], string='收款类型', store=True)
remake = fields.Char(string='备注')
+ @api.depends('contract_id')
+ def _compute_property_name(self):
+ for record in self:
+ record.property_name = record.contract_id.property_name
+
@api.depends('contract_id', 'contract_id.lease_ids', 'contract_id.lease_ids.address_id')
def _compute_property_ids(self):
for record in self:
diff --git a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml
index d7b8361cc..acd38375f 100644
--- a/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml
+++ b/yuthon_property_approval/wizard/property_reconciliation_wizard_views.xml
@@ -30,6 +30,7 @@
+