diff --git a/yuthon_property/models/yuthon_precinct_message.py b/yuthon_property/models/yuthon_precinct_message.py index 8f9f29086..d55ac92ee 100644 --- a/yuthon_property/models/yuthon_precinct_message.py +++ b/yuthon_property/models/yuthon_precinct_message.py @@ -5,5 +5,7 @@ from odoo.exceptions import UserError, ValidationError class YuthonPrecinctMessage(models.Model): _name = 'yuthon.precinct.message' _description = '片区管理' + _order = 'sequence' - name = fields.Char(string='片区名称') \ No newline at end of file + name = fields.Char(string='片区名称') + sequence = fields.Integer(string='片区序号') \ No newline at end of file diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index fa74f6291..c264186a0 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -71,6 +71,9 @@ class YuthonProperty(models.Model): rental_address = fields.Text(string="出租地址") tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型') ame = fields.Char(string='标题') + management_area = fields.Float(string="管理面积", group_operator="sum") + rent_area = fields.Float(string="可租面积", group_operator="sum") + equity_area = fields.Float(string="产权面积", group_operator="sum") decoration_type = fields.Selection([('blank', '毛坯'), ('hardcover', '精装'), ('brands', '简装'), ('rsz', '豪装')], string="装修类型") water_meter_ids = fields.One2many('yuthon.property.water', 'yuthon_property_id', string='水表列表') @@ -83,6 +86,18 @@ class YuthonProperty(models.Model): 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): + for rec in self: + manage_information_ids = rec.manage_information_ids + if manage_information_ids: + latest_record_id = sorted(manage_information_ids, key=lambda x: x.start_time, reverse=True)[0] + rec.write({ + 'management_area':latest_record_id.management_area, + 'rent_area': latest_record_id.rent_area, + 'equity_area':latest_record_id.equity_area + }) + @api.onchange('building_area') def _onchange_building_area(self): for rec in self: diff --git a/yuthon_property/views/yuthon_precinct_message_views.xml b/yuthon_property/views/yuthon_precinct_message_views.xml index eb16f0f99..3722639b7 100644 --- a/yuthon_property/views/yuthon_precinct_message_views.xml +++ b/yuthon_property/views/yuthon_precinct_message_views.xml @@ -5,6 +5,7 @@ yuthon.precinct.message + diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml index efa004144..1d74a0bb7 100644 --- a/yuthon_property/views/yuthon_property_views.xml +++ b/yuthon_property/views/yuthon_property_views.xml @@ -12,6 +12,9 @@ + + +