@@ -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',
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record forcecreate="True" id="update_property_contract_time" model="ir.cron">
|
||||
<field name="name">定时任务:更新物业合同状态</field>
|
||||
<field name="model_id" ref="model_property_lease_contract"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model.get_property_contract_time()</field>
|
||||
<field eval="True" name="active"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">days</field>
|
||||
<field name="nextcall" eval="(DateTime.now()).strftime('%Y-%m-%d 00:00:00')"/>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -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 = '物业列表明细行'
|
||||
|
||||
Reference in New Issue
Block a user