From bb09bb943fe212e6a7ffeb678c66a8eebaad656a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Wed, 15 Oct 2025 19:58:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_property/models/property_meter_archives.py | 10 +++++++++- yuthon_property/models/property_meter_water.py | 4 ++-- yuthon_property/models/yuthon_property.py | 1 + .../views/property_meter_archives_views.xml | 1 + yuthon_property/views/property_meter_water_views.xml | 1 + yuthon_property/views/yuthon_property_views.xml | 1 + .../views/inherit_yuthon_property_views.xml | 2 -- 7 files changed, 15 insertions(+), 5 deletions(-) diff --git a/yuthon_property/models/property_meter_archives.py b/yuthon_property/models/property_meter_archives.py index 1e2ecd659..d0f366e3d 100644 --- a/yuthon_property/models/property_meter_archives.py +++ b/yuthon_property/models/property_meter_archives.py @@ -64,7 +64,6 @@ class PropertyMeterArchives(models.Model): raise ValidationError( f"仪表编号 '{vals['name']}' 已存在,请使用其他编号!" ) - record.archives_state = "rent" if record.lessee_id else "use" return record def update_epitope_values(self): @@ -225,6 +224,7 @@ class MeterArchivesLine(models.Model): related="archives_id.sequence1", string="表序号", store=True ) epitope_values_id = fields.Many2one("yuthon.epitope.values", string="表位置") + lessee_id = fields.Many2one("property.tenant.information", string="承租方") yuthon_property_ids = fields.Many2many("yuthon.property", string="物业信息") last_meter = fields.Date(string="上次抄表日期", compute="_compute_last") last_dosage = fields.Float( @@ -356,6 +356,14 @@ class MeterArchivesLine(models.Model): f"输入错误:仪表编号为{record.archives_id.name}当前读数 {record.current_read} 必须大于上次读数 {record.last_read} " ) + @api.onchange("yuthon_property_ids") + def compute_lessee_id(self): + for record in self: + if record.yuthon_property_ids: + record.lessee_id = record.yuthon_property_ids[0].lessee_id + else: + record.lessee_id = False + def update_date(self): meter_ids = self.env["meter.archives.line"].browse( self._context.get("active_ids", self._context.get("active_id")) diff --git a/yuthon_property/models/property_meter_water.py b/yuthon_property/models/property_meter_water.py index 5a50b4268..8f294e95d 100644 --- a/yuthon_property/models/property_meter_water.py +++ b/yuthon_property/models/property_meter_water.py @@ -65,7 +65,6 @@ class PropertyMeterWater(models.Model): raise ValidationError( f"仪表编号 '{vals['name']}' 已存在,请使用其他编号!" ) - record.water_state = "rent" if record.lessee_id else "use" return record def update_epitope_values(self): @@ -115,7 +114,7 @@ class PropertyMeterWater(models.Model): return self.line_ids.write({ 'yuthon_property_ids': [(6, 0, self.yuthon_property_ids.ids)] if self.yuthon_property_ids else [], - 'epitope_values_id': self.epitope_values_id.id if self.epitope_values_id else False + 'epitope_values_id': self.epitope_values_id.id }) self.update_epitope_values() @@ -183,6 +182,7 @@ class MeterWaterLine(models.Model): ) sequence = fields.Integer(related="water_id.sequence1", string="表序号", store=True) epitope_values_id = fields.Many2one("yuthon.epitope.values", string="表位置") + lessee_id = fields.Many2one("property.tenant.information", string="承租方") yuthon_property_ids = fields.Many2many("yuthon.property", string="物业信息") last_meter = fields.Date(string="上次抄表日期", compute="_compute_last") last_dosage = fields.Float( diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index 6b5ce6c45..87c6a398d 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -58,6 +58,7 @@ class YuthonProperty(models.Model): suite_area = fields.Float(string="套内面积", digits=(16, 4)) purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型", compute="compute_information_fields", store=True) admin_id = fields.Many2one('res.users', string="片区管理员", compute="compute_information_fields", store=True) + lessee_id = fields.Many2one('property.tenant.information', string='承租方') title_address = fields.Many2one('yuthon.property.message', string="产权地址", compute="_compute_title_information_fields", store=True) company_id = fields.Many2one('yuthon.property.company', string="公司", compute="compute_information_fields", store=True) rental_address = fields.Text(string="出租地址") diff --git a/yuthon_property/views/property_meter_archives_views.xml b/yuthon_property/views/property_meter_archives_views.xml index 63bbbed5c..f35b85d32 100644 --- a/yuthon_property/views/property_meter_archives_views.xml +++ b/yuthon_property/views/property_meter_archives_views.xml @@ -102,6 +102,7 @@ + diff --git a/yuthon_property/views/property_meter_water_views.xml b/yuthon_property/views/property_meter_water_views.xml index 5cfd65690..2ab02a642 100644 --- a/yuthon_property/views/property_meter_water_views.xml +++ b/yuthon_property/views/property_meter_water_views.xml @@ -109,6 +109,7 @@ + diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml index 10bf8c2ac..27456fc25 100644 --- a/yuthon_property/views/yuthon_property_views.xml +++ b/yuthon_property/views/yuthon_property_views.xml @@ -88,6 +88,7 @@ + diff --git a/yuthon_property_approval/views/inherit_yuthon_property_views.xml b/yuthon_property_approval/views/inherit_yuthon_property_views.xml index d82722b85..77727ac04 100644 --- a/yuthon_property_approval/views/inherit_yuthon_property_views.xml +++ b/yuthon_property_approval/views/inherit_yuthon_property_views.xml @@ -26,7 +26,6 @@ - @@ -37,7 +36,6 @@ -