diff --git a/yuthon_property/views/property_meter_archives_views.xml b/yuthon_property/views/property_meter_archives_views.xml index b7ee200c2..31b641bbe 100644 --- a/yuthon_property/views/property_meter_archives_views.xml +++ b/yuthon_property/views/property_meter_archives_views.xml @@ -61,7 +61,6 @@ - diff --git a/yuthon_property/views/property_meter_water_views.xml b/yuthon_property/views/property_meter_water_views.xml index d5a92df03..d824d68d9 100644 --- a/yuthon_property/views/property_meter_water_views.xml +++ b/yuthon_property/views/property_meter_water_views.xml @@ -61,7 +61,6 @@ - diff --git a/yuthon_property_approval/models/property_early_quitting.py b/yuthon_property_approval/models/property_early_quitting.py index 3aeec428b..c6bca8af3 100644 --- a/yuthon_property_approval/models/property_early_quitting.py +++ b/yuthon_property_approval/models/property_early_quitting.py @@ -13,11 +13,11 @@ class PropertyEarlyQuitting(models.Model): name = fields.Char(string='标题') code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_early_quitting_code')) - property_documents_ids = fields.Many2many('documents.document', string="提前退租文件") - lessee = fields.Char(string='承租方') + property_documents_ids = fields.Many2many('ir.attachment', string="提前退租文件") + lessee_id = fields.Many2one(related='address_id.lessee_id', string="承租方") + address_id = fields.Many2one('yuthon.property', string="物业地址") start_data = fields.Date(string="合同开始日期") end_data = fields.Date(string="合同结束日期") early_quitting_date = fields.Date(string="提前退租日期") - contract_id = fields.Many2one('documents.document', string="合同") - address = fields.Char(string="地址") + contract_id = fields.Many2one('ir.attachment', string="合同") reason = fields.Char(string="退租原因") \ 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 926a56b11..d851174e0 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -74,7 +74,6 @@ class PropertyLeaseContract(models.Model): lease_term_month = fields.Integer(string="租期(月)") lease_term_day = fields.Integer(string="租期(日)") term_start_time = fields.Date(string="开始时间", default=fields.Datetime.now) - term_start_month_day = fields.Char(string="开始时间", compute="_compute_term_start_month_day") term_end_time = fields.Date(string="结束时间") actual_start_time = fields.Date(string="实际开始时间") actual_end_time = fields.Date(string="实际结束时间", default=fields.Datetime.now) @@ -82,7 +81,6 @@ class PropertyLeaseContract(models.Model): expiration_coming = fields.Selection([('coming', '即将到期'), ('expired', '已到期')], string="结束时间对比(状态)", compute='_compute_expiration_coming', store=True) is_equal = fields.Boolean(string="是否相等", compute='_compute_end_comparison', store=True) - term_end_month_day = fields.Char(string="结束时间", compute="_compute_term_end_month_day") cycle_dict =fields.Selection([('monthly', '月度'), ('quarter', '季度'), ('half', '半年'),('year', '年度')],string='付款方式', default='monthly', help="应收") cycle_mode = fields.Selection([('fixed_monthly', '合同月'), ('floating_monthly', '自然月'), ('fixed_quarter', '合同季'), ('floating_quarter', '自然季'), ('fixed_year', '合同年'), ('floating_year', '自然年')], string='周期方式', default='fixed_monthly') @@ -201,22 +199,6 @@ class PropertyLeaseContract(models.Model): else: record.expiration_coming = None - @api.depends('term_start_time') - def _compute_term_start_month_day(self): - for record in self: - if record.term_start_time: - record.term_start_month_day = record.term_start_time.strftime('%Y-%m') - else: - record.term_start_month_day = '' - - @api.depends('term_end_time') - def _compute_term_end_month_day(self): - for record in self: - if record.term_end_time: - record.term_end_month_day = record.term_end_time.strftime('%Y-%m') - else: - record.term_end_month_day = '' - @api.onchange('total_area', 'rent') def _onchange_unit_price(self): for i in self: @@ -1104,6 +1086,49 @@ 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': '延租申请', + "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 + }, + } + + # 退租 + def button_lease_return(self): + form_id = self.env.ref('yuthon_property_approval.view_property_early_quitting_form').id + address_id = self.lease_ids[0].address_id if self.lease_ids else '' + return { + 'name': '延租申请', + "type": "ir.actions.act_window", + 'view_mode': 'form', + 'res_model': 'property.early.quitting', + "views": [[form_id, "form"]], + "context": { + 'default_address_id': address_id.id, + 'default_end_data': self.term_end_time, + 'default_start_data': self.term_start_time, + }, + } + + # 变更 + def button_lease_change(self): + form_id = self.env.ref('yuthon_property_approval.view_property_lease_renewal_form').id + return { + 'name': '变更申请', + "type": "ir.actions.act_window", + 'view_mode': 'form', + 'res_model': 'property.lease.renewal', + "views": [[form_id, "form"]], + } + class PropertyLeaseContractLine(models.Model): _name = 'property.lease.contract.line' diff --git a/yuthon_property_approval/models/property_lease_extension.py b/yuthon_property_approval/models/property_lease_extension.py index 7585ae3a9..526c73866 100644 --- a/yuthon_property_approval/models/property_lease_extension.py +++ b/yuthon_property_approval/models/property_lease_extension.py @@ -13,10 +13,10 @@ class PropertyLeaseExtension(models.Model): name = fields.Char(string='标题') code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_lease_extension_code')) - property_documents_ids = fields.Many2many('documents.document', string="延租文件") - original_contract_id = fields.Many2one('documents.document', string="原合同") - lessee = fields.Char(string="承租方") - address = fields.Char(string="地址") + property_documents_ids = fields.Many2many('ir.attachment', string="延租文件") + 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="物业地址") end_date = fields.Date(string="原到期时间") new_end_date = fields.Date(string="延期至") reason_extension = fields.Char(string="延期原因") diff --git a/yuthon_property_approval/views/property_early_quitting.xml b/yuthon_property_approval/views/property_early_quitting.xml index 6df590a5f..0ca44b8a2 100644 --- a/yuthon_property_approval/views/property_early_quitting.xml +++ b/yuthon_property_approval/views/property_early_quitting.xml @@ -27,18 +27,17 @@ - + - + - - + - + diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index f05fc8ab2..f17ca3286 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -298,7 +298,7 @@ - + @@ -312,14 +312,17 @@ - - - + + +