diff --git a/yuthon_property/data/yuthon_new_property.xml b/yuthon_property/data/yuthon_new_property.xml index 45f249011..bdafe8453 100644 --- a/yuthon_property/data/yuthon_new_property.xml +++ b/yuthon_property/data/yuthon_new_property.xml @@ -1,6 +1,19 @@ + + 定时任务:更新物业管理信息 + + code + model.update_manage() + + + 1 + days + + -1 + + 定时任务:触发只显示最新物业方法 diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index 612f39ee6..8dfab6bb6 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -13,6 +13,7 @@ class YuthonProperty(models.Model): _order = 'first_letter' name = fields.Text(string="资产名称") + tax = fields.Float(string="税率", default=0.09) users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) code = fields.Char(string="物业编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_property_message_code')) referred_id = fields.Many2one('yuthon.lot.setting', string="地段") @@ -222,6 +223,11 @@ class YuthonProperty(models.Model): 'equity_area': latest_title.equity_area, }) + def update_manage(self): + property_ids = self.env['yuthon.property'].search([]) + for record in property_ids: + record.compute_information_fields() + @api.depends('manage_information_ids.start_time', 'manage_information_ids.end_date', 'manage_information_ids.precinct_id', 'manage_information_ids.tenure_type', 'manage_information_ids.management_area', 'manage_information_ids.rent_area', diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml index fe94712b6..98253023d 100644 --- a/yuthon_property/views/yuthon_property_views.xml +++ b/yuthon_property/views/yuthon_property_views.xml @@ -72,6 +72,7 @@ + diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 51a7d26df..19445b586 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -325,6 +325,28 @@ class PropertyLeaseContract(models.Model): employee_ids = fields.Many2many('hr.employee', string="当前经办人", compute='_compute_workflow') approve_state = fields.Selection([("start", "草稿"), ("pending", "审批中"), ("end", "结束")], string="审批状态", compute='_compute_workflow') + @api.onchange('term_start_time') + def onchange_lessor_id(self): + if not self.term_start_time: + return + if not self.lease_ids: + return + property_id = self.lease_ids[0].address_id.id + manage_line_domain = [ + ('yuthon_property_id', '=', property_id), + ('start_time', '<=', self.term_start_time), + '|', + ('end_date', '=', False), + ('end_date', '>=', self.term_start_time) + ] + manage_line = self.env['manage.information.line'].search( + manage_line_domain, + order='start_time desc', + limit=1 + ) + if manage_line and manage_line.company_id: + self.lessor_id = manage_line.company_id.id + @api.depends('code') def _compute_workflow(self): for record in self: @@ -2351,6 +2373,7 @@ class PropertyLeaseContractLine(models.Model): accounting_id = fields.Many2one('property.accounting.approval', string="关联建设工程委托监理合同审批") supervising_id = fields.Many2one('property.supervising.approval', string="关联建设工程施工合同审批") address_id = fields.Many2one('yuthon.property', string="物业地址") + tax = fields.Float(related='address_id.tax',string="税率") admin_line_id = fields.Many2one(related='address_id.admin_id', string="管理员", store=True) property_area = fields.Float(related='address_id.rent_area', string="可租面积", store=True) message_standard_id = fields.Many2one(related='address_id.message_standard_id', string="管理费标准", store=True) diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index 8fa3bd9a2..8440aa0f6 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -556,6 +556,7 @@ +