Merge pull request !1063 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-01-02 11:58:42 +00:00
committed by Gitee
4 changed files with 45 additions and 3 deletions
+1 -2
View File
@@ -92,7 +92,6 @@ class YuthonProperty(models.Model):
rec.write({
'management_area':latest_record_id.management_area,
'rent_area': latest_record_id.rent_area,
'equity_area':latest_record_id.equity_area,
'admin_id':latest_record_id.admin_id.id
})
@@ -307,7 +306,7 @@ class TitleInformationLine(models.Model):
yuthon_property_id = fields.Many2one('yuthon.property', string="关联物业信息")
property_message_id = fields.Many2one('yuthon.property.message', string='产权地址')
owner_id = fields.Many2one(related='property_message_id.owner_id', string="权属人")
equity_area = fields.Float(string="产权面积", digits=(16, 4))
equity_area = fields.Float(related='property_message_id.equity_area', string="产权面积", digits=(16, 4))
title_certificate = fields.Char(related='property_message_id.title_certificate', string="产权证号")
start_time = fields.Date(string="生效日期", default=fields.Date.today)
end_date = fields.Date(string="失效日期")
@@ -9,5 +9,6 @@ class YuthonPropertyMessage(models.Model):
name = fields.Char(string='产权地址')
owner_id = fields.Many2one('yuthon.owner.message', string="权属人")
title_certificate = fields.Char(string="产权证号")
equity_area = fields.Float(string="产权面积", digits=(16, 4))
documents_ids = fields.Many2many('ir.attachment', string="附件")
@@ -8,6 +8,7 @@
<field name="name"/>
<field name="owner_id"/>
<field name="title_certificate"/>
<field name="equity_area"/>
<field name="documents_ids" widget="preview_many2many"/>
</tree>
</field>
@@ -24,7 +24,7 @@ class YuthonPropertyWizard(models.Model):
sh = book.sheet_by_index(0)
for rx in range(1, sh.nrows):
row = sh.row(rx)
self.yuthon_property_data(row)
self.yuthon_property_update(row)
def yuthon_property_data(self,row):
property_name = row[2].value
@@ -130,3 +130,44 @@ class YuthonPropertyWizard(models.Model):
'property_message_id': property_message_id.id,
}))
property_id.title_information_ids = information_list
def yuthon_property_update(self,row):
property_message_id = self.env['yuthon.property.message'].search([('name', '=', row[0].value)])
equity_area = row[5].value
property_id = self.env['yuthon.property'].search([('name', '=', row[1].value)])
company_id = self.env['yuthon.property.company'].search([('name', '=', row[2].value)])
if not company_id:
company_id = self.env['yuthon.property.company'].create({
'name': row[2].value,
})
tenure_type_dict = {'自有': 'self', '代管': 'agency', '': ''}
tenure_type = tenure_type_dict.get(row[3].value, '')
admin_id = self.env['res.users'].search([('name', '=', row[4].value)])
management_area = row[6].value
rent_area = row[7].value
precinct_id = self.env['yuthon.precinct.message'].search([('name', '=', row[8].value)])
if property_id:
management_list = []
management_list.append((0, 0, {
'yuthon_property_id':property_id.id,
'company_id':company_id.id,
'tenure_type':tenure_type,
'management_area':management_area,
'rent_area':rent_area,
'admin_id':admin_id.id,
'precinct_id':precinct_id.id,
}))
property_id.manage_information_ids = management_list
if property_message_id:
property_message_id.write({
'equity_area': equity_area
})
information_list = []
information_list.append((0, 0, {
'yuthon_property_id': property_id.id,
'property_message_id': property_message_id.id,
}))
property_id.title_information_ids = information_list