diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index 27444c4d1..24b97a279 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -82,7 +82,6 @@ class YuthonProperty(models.Model): disassembly_information_ids = fields.One2many('disassembly.information.line', 'yuthon_property_id', string='关联拆分信息明细行') property_merge_approval_id = fields.Many2one('yuthon.property', string='关联物业信息') - manage_fee_line_ids = fields.One2many('manage.information.fee.line', 'yuthon_property_id', string='关联管理费明细行') @api.onchange('manage_information_ids') def _onchange_information_ids(self): @@ -268,41 +267,37 @@ class YuthonProperty(models.Model): class YuthonPropertyWater(models.Model): _name = 'yuthon.property.water' _description = '水表' - _rec_name = 'code' - property_meter_water_id = fields.Many2one('property.meter.water', string="关联水表库") - code = fields.Char(string='编码') + property_meter_water_id = fields.Many2one('property.meter.water', string="水表库") rate = fields.Integer(string="倍率") standard = fields.Integer(string="标准") - installation_date = fields.Datetime(string="安装日期") - demolition_date = fields.Datetime(string="拆除日期") + installation_date = fields.Date(string="安装日期") + demolition_date = fields.Date(string="拆除日期") location = fields.Char(string="位置") yuthon_property_id = fields.Many2one('yuthon.property', string="物业管理") - @api.onchange('property_meter_water_id') - def _onchange_water_meter_ids(self): - for rec in self: - rec.property_meter_water_id.write({'yuthon_property_id': rec.property_meter_water_id.id}) + # @api.onchange('property_meter_water_id') + # def _onchange_water_meter_ids(self): + # for rec in self: + # rec.property_meter_water_id.write({'yuthon_property_id': rec.property_meter_water_id.id}) class YuthonPropertyEnergy(models.Model): _name = 'yuthon.property.energy' _description = '电表' - _rec_name = 'code' - property_meter_archives_id = fields.Many2one('property.meter.archives', string="关联电表库") - code = fields.Char(string='编码') + property_meter_archives_id = fields.Many2one('property.meter.archives', string="电表库") rate = fields.Integer(string="倍率") standard = fields.Integer(string="标准") - installation_date = fields.Datetime(string="安装日期") - demolition_date = fields.Datetime(string="拆除日期") + installation_date = fields.Date(string="安装日期") + demolition_date = fields.Date(string="拆除日期") location = fields.Char(string="位置") yuthon_property_id = fields.Many2one('yuthon.property', string="物业管理") - @api.onchange('property_meter_archives_id') - def _onchange_water_meter_ids(self): - for rec in self: - rec.property_meter_archives_id.write({'yuthon_property_id': rec.property_meter_archives_id.id}) + # @api.onchange('property_meter_archives_id') + # def _onchange_water_meter_ids(self): + # for rec in self: + # rec.property_meter_archives_id.write({'yuthon_property_id': rec.property_meter_archives_id.id}) class TitleInformationLine(models.Model): @@ -344,10 +339,4 @@ class DisassemblyInformationLine(models.Model): start_time = fields.Date(related='property_id.start_time',string="生效日期") end_date = fields.Date(related='property_id.end_date',string="失效日期") -class ManageInformationFeeLine(models.Model): - _name = 'manage.information.fee.line' - _description = '管理费用明细行' - - yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息") - manage_id = fields.Many2one('property.message.fee', string="管理费标准") diff --git a/yuthon_property/security/ir.model.access.csv b/yuthon_property/security/ir.model.access.csv index 4b59e43d5..d3d421be9 100644 --- a/yuthon_property/security/ir.model.access.csv +++ b/yuthon_property/security/ir.model.access.csv @@ -51,7 +51,6 @@ access_yuthon_property_lessee, yuthon_property_lessee,model_yuthon_property_less access_yuthon_property_lessee,yuthon_property_lessee,model_yuthon_property_lessee,base.group_user,1,1,1,1 access_yuthon_electricity_setting,yuthon_electricity_setting,model_yuthon_electricity_setting,base.group_user,1,1,1,1 access_yuthon_water_setting,yuthon_water_setting,model_yuthon_water_setting,base.group_user,1,1,1,1 -access_manage_information_fee_line,manage.information.fee.line,model_manage_information_fee_line,base.group_user,1,1,1,1 access_yuthon_lot_setting,yuthon_lot_setting,model_yuthon_lot_setting,base.group_user,1,1,1,1 access_yuthon_property_wizard,yuthon_property_wizard,model_yuthon_property_wizard,base.group_user,1,1,1,1 access_yuthon_property_company,yuthon_property_company,model_yuthon_property_company,base.group_user,1,1,1,1 \ No newline at end of file diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml index 90d7a604b..96f1cf4c3 100644 --- a/yuthon_property/views/yuthon_property_views.xml +++ b/yuthon_property/views/yuthon_property_views.xml @@ -171,8 +171,7 @@ - - + @@ -186,7 +185,6 @@ - @@ -195,14 +193,6 @@ - - - - - - - -
diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 8e0f04e95..0ecc9a246 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -450,6 +450,41 @@ class PropertyLeaseContract(models.Model): for record in self: record.deposit = record.total_area * record.unit_price * 2 # 月租金 + @api.onchange("lease_ids") + def _onchange_lease_ids(self): + lease_list = [] + electricity_list = [] + fee_list = [] + for rec in self: + for record in rec.lease_ids: + property_id = self.env['yuthon.property'].search([('id', '=', record.address_id.id)]) + # if property_id.water_meter_ids: + # for water_id in property_id.water_meter_ids: + # lease_list.append([0, 0, { + # 'contract_id': self.id, + # 'fees_id': property_id.meter_id.id, + # 'proportional': water_id.rate, + # 'start_data': water_id.installation_date, + # 'end_data':water_id.demolition_date + # }]) + if property_id.energy_meter_ids: + for electricity_id in property_id.energy_meter_ids: + electricity_list.append([0, 0, { + 'fees_id': property_id.electricity_id.id, + 'proportional':electricity_id.rate, + 'start_data': electricity_id.installation_date, + 'end_data':electricity_id.demolition_date + }]) + if property_id.message_standard_id: + fee_list.append([0, 0, { + 'fees_id': property_id.message_standard_id.id, + 'proportional':property_id.message_standard_id.amount}]) + + rec.electricity_fee_ids = [(5, 0, 0)] + rec.mange_fee_ids = [(5, 0, 0)] + rec.electricity_fee_ids = electricity_list + rec.mange_fee_ids = fee_list + class PropertyLeaseContractLine(models.Model): _name = 'property.lease.contract.line' _description = '物业列表明细行' @@ -478,8 +513,9 @@ class PropertyWaterFeeLine(models.Model): _description = '物业水费明细行' contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批") + address_id = fields.Many2one('yuthon.property', string="物业地址") charges = fields.Char(string="收费项") - fees = fields.Char(string="收费标准") + fees_id = fields.Many2one('yuthon.water.setting', string="收费标准") proportional = fields.Float(string="赔率/比例") start_data = fields.Date(string="开始日期") end_data = fields.Date(string="结束日期") @@ -491,7 +527,7 @@ class PropertyElectricFeeLine(models.Model): contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批") charges = fields.Char(string="收费项") - fees = fields.Char(string="收费标准") + fees_id = fields.Many2one('yuthon.electricity.setting', string="收费标准") proportional = fields.Float(string="赔率/比例") start_data = fields.Date(string="开始日期") end_data = fields.Date(string="结束日期") @@ -502,7 +538,7 @@ class PropertyManageFeeLine(models.Model): contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批") charges = fields.Char(string="收费项") - fees = fields.Char(string="收费标准") + fees_id = fields.Many2one('property.message.fee', string="收费标准") proportional = fields.Float(string="赔率/比例") start_data = fields.Date(string="开始日期") end_data = fields.Date(string="结束日期") diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index b3926c1cf..26be45d36 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -64,7 +64,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -88,7 +88,7 @@ - +