@@ -19,6 +19,8 @@ MENU_BADGE_MODEL_FUNC_ENUM = {
|
||||
'yuthon_notice.yuthon_notice_my_menu': {'model': 'yuthon.notice', 'func': 'get_no_read_count'},
|
||||
'soong_workflow.menu_workflow_approval_request_my': {'model': 'soong.workflow.record', 'func': 'get_no_read_count'},
|
||||
'yuthon_will_task.menu_yuthon_will_task_root': {'model': 'yuthon.will.task', 'func': 'read_number'},
|
||||
'yuthon_property_approval.property_lease_contract_coming_menu': {'model': 'property.lease.contract', 'func': 'read_coming_count'},
|
||||
'yuthon_property_approval.property_lease_contract_coming_due_menu': {'model': 'property.lease.contract', 'func': 'read_due_count'},
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,5 +19,11 @@ class PropertyEarlyQuitting(models.Model):
|
||||
start_data = fields.Date(string="合同开始日期")
|
||||
end_data = fields.Date(string="合同结束日期")
|
||||
early_quitting_date = fields.Date(string="提前退租日期")
|
||||
contract_id = fields.Many2one('ir.attachment', string="合同")
|
||||
reason = fields.Char(string="退租原因")
|
||||
original_contract_id = fields.Many2one('ir.attachment', string="合同")
|
||||
contract_id = fields.Many2one('yuthon.property.contract', string="合同")
|
||||
reason = fields.Char(string="退租原因")
|
||||
|
||||
def button_approval(self):
|
||||
for rec in self:
|
||||
rec.contract_id.write({
|
||||
'actual_end_time': rec.new_end_date})
|
||||
|
||||
@@ -185,10 +185,12 @@ class PropertyLeaseContract(models.Model):
|
||||
if record.term_end_time and record.actual_end_time:
|
||||
if record.actual_end_time < record.term_end_time:
|
||||
delta = record.term_end_time - record.actual_end_time
|
||||
if 0< delta.days < 90:
|
||||
if 30< delta.days < 90:
|
||||
record.expiration_coming = 'coming'
|
||||
elif record.actual_end_time == record.term_end_time:
|
||||
record.expiration_coming = 'due'
|
||||
elif delta.days <=30:
|
||||
record.expiration_coming = 'due'
|
||||
else:
|
||||
record.expiration_coming = None
|
||||
else:
|
||||
record.expiration_coming = None
|
||||
else:
|
||||
@@ -1081,18 +1083,19 @@ class PropertyLeaseContract(models.Model):
|
||||
record.write({'condition': 'executed'})
|
||||
elif current_date < record.term_start_time:
|
||||
record.write({'condition': 'be_executed'})
|
||||
# 延租
|
||||
# 续租
|
||||
def button_lease_extension(self):
|
||||
form_id = self.env.ref('yuthon_property_approval.view_property_lease_extension_form').id
|
||||
address_id = self.lease_ids[0].address_id if self.lease_ids else ''
|
||||
return {
|
||||
'name': '延租申请',
|
||||
'name': '续租申请',
|
||||
"type": "ir.actions.act_window",
|
||||
'res_model': 'property.lease.extension',
|
||||
"views": [[form_id, "form"]],
|
||||
"context": {
|
||||
'default_address_id': address_id.id,
|
||||
'default_end_date': self.term_end_time
|
||||
'default_end_date': self.term_end_time,
|
||||
'default_contract_id': self.id
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1110,6 +1113,7 @@ class PropertyLeaseContract(models.Model):
|
||||
'default_address_id': address_id.id,
|
||||
'default_end_data': self.term_end_time,
|
||||
'default_start_data': self.term_start_time,
|
||||
'default_contract_id': self.id,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1124,6 +1128,11 @@ class PropertyLeaseContract(models.Model):
|
||||
"views": [[form_id, "form"]],
|
||||
}
|
||||
|
||||
def read_coming_count(self):
|
||||
return self.search_count([('expiration_coming', '=', 'coming'), ('admin_id', '=', self.env.user.id)])
|
||||
|
||||
def read_due_count(self):
|
||||
return self.search_count([('expiration_coming', '=', 'due'), ('admin_id', '=', self.env.user.id)])
|
||||
|
||||
class PropertyLeaseContractLine(models.Model):
|
||||
_name = 'property.lease.contract.line'
|
||||
|
||||
@@ -6,7 +6,7 @@ from odoo import models, fields, api, exceptions, _
|
||||
|
||||
class PropertyLeaseExtension(models.Model):
|
||||
_name = 'property.lease.extension'
|
||||
_description = '延租申请'
|
||||
_description = '续租申请'
|
||||
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin']
|
||||
_rec_name = 'name'
|
||||
|
||||
@@ -17,6 +17,12 @@ class PropertyLeaseExtension(models.Model):
|
||||
original_contract_id = fields.Many2one('ir.attachment', string="原合同")
|
||||
lessee_id = fields.Many2one(related='address_id.lessee_id', string="承租方")
|
||||
address_id = fields.Many2one('yuthon.property', string="物业地址")
|
||||
contract_id = fields.Many2one('yuthon.property.contract', string="合同")
|
||||
end_date = fields.Date(string="原到期时间")
|
||||
new_end_date = fields.Date(string="延期至")
|
||||
reason_extension = fields.Char(string="延期原因")
|
||||
|
||||
def button_approval(self):
|
||||
for rec in self:
|
||||
rec.contract_id.write({
|
||||
'actual_end_time': rec.new_end_date})
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<group>
|
||||
<field name="lessee_id"/>
|
||||
<field name="end_data"/>
|
||||
<field name="contract_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="address_id"/>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<group>
|
||||
<field name="original_contract_id" widget="preview_many2one"/>
|
||||
<field name="lessee_id"/>
|
||||
<field name="contract_id" invisible="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="address_id"/>
|
||||
|
||||
Reference in New Issue
Block a user