diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index bfaa7bd78..387bd1684 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -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="失效日期")
diff --git a/yuthon_property/models/yuthon_property_message.py b/yuthon_property/models/yuthon_property_message.py
index e1e046bef..d63eea638 100644
--- a/yuthon_property/models/yuthon_property_message.py
+++ b/yuthon_property/models/yuthon_property_message.py
@@ -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="附件")
diff --git a/yuthon_property/views/yuthon_property_message_views.xml b/yuthon_property/views/yuthon_property_message_views.xml
index 1725a717d..2f5930409 100644
--- a/yuthon_property/views/yuthon_property_message_views.xml
+++ b/yuthon_property/views/yuthon_property_message_views.xml
@@ -8,6 +8,7 @@
+
diff --git a/yuthon_property/wizard/yuthon_property_wizard.py b/yuthon_property/wizard/yuthon_property_wizard.py
index a26e5a024..750c27554 100644
--- a/yuthon_property/wizard/yuthon_property_wizard.py
+++ b/yuthon_property/wizard/yuthon_property_wizard.py
@@ -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
+