From b39d44eacdfad9c988502faf717b89176240609f Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Fri, 10 Jan 2025 18:53:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_property_approval/__manifest__.py | 1 + .../data/property_contract_time.xml | 18 ++++++++++++++++++ .../models/property_lease_contract.py | 10 ++++++++++ 3 files changed, 29 insertions(+) create mode 100644 yuthon_property_approval/data/property_contract_time.xml diff --git a/yuthon_property_approval/__manifest__.py b/yuthon_property_approval/__manifest__.py index 90c34510e..b112eb7e1 100644 --- a/yuthon_property_approval/__manifest__.py +++ b/yuthon_property_approval/__manifest__.py @@ -9,6 +9,7 @@ 'license': 'LGPL-3', 'data': [ 'data/sale_renting_code_data.xml', + 'data/property_contract_time.xml', 'security/ir.model.access.csv', 'views/property_billing_confirmation.xml', 'views/property_approval_views.xml', diff --git a/yuthon_property_approval/data/property_contract_time.xml b/yuthon_property_approval/data/property_contract_time.xml new file mode 100644 index 000000000..678bc6586 --- /dev/null +++ b/yuthon_property_approval/data/property_contract_time.xml @@ -0,0 +1,18 @@ + + + + + 定时任务:更新物业合同状态 + + code + model.get_property_contract_time() + + + 1 + days + + -1 + + + + \ No newline at end of file diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 310d01e86..840803851 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -1083,6 +1083,16 @@ class PropertyLeaseContract(models.Model): if record.lease_ids: record.admin_id = record.lease_ids[0].admin_id.id + def get_property_contract_time(self): + for record in self.search([]): + if record.term_start_time: + current_date = date.today() + if record.condition != 'cancel': + if current_date >= record.term_start_time: + record.write({'message_type': 'executed'}) + elif current_date < record.term_start_time: + record.write({'message_type': 'be_executed'}) + class PropertyLeaseContractLine(models.Model): _name = 'property.lease.contract.line' _description = '物业列表明细行'