From f09aa15e6fce4ccc415697a7fa10ab3b4e79eb96 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: Sat, 20 Sep 2025 18:23:38 +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 --- .../models/property_meter_water.py | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/yuthon_property/models/property_meter_water.py b/yuthon_property/models/property_meter_water.py index 19ecf7891..e589090a5 100644 --- a/yuthon_property/models/property_meter_water.py +++ b/yuthon_property/models/property_meter_water.py @@ -151,35 +151,35 @@ class PropertyMeterWater(models.Model): } - class MeterWaterLine(models.Model): - _name = 'meter.water.line' - _description = '水表库明细行' +class MeterWaterLine(models.Model): + _name = 'meter.water.line' + _description = '水表库明细行' - water_id = fields.Many2one('property.meter.water', string='水表库', required=True, ondelete='cascade') - name = fields.Char(string='仪表编号') - epitope_values = fields.Char(string='表位置') - lessee_id = fields.Many2one('property.tenant.information', string='承租方', compute='_compute_lessee_id') - yuthon_property_ids = fields.Many2many('yuthon.property', string='物业信息') - last_meter = fields.Date(string='上次抄表日期') - last_dosage = fields.Float(string='上次用量', compute="_compute_last_dosage") - last_read = fields.Float(string='上次读数', readonly=True) - current_meter = fields.Float(string='本次用量', readonly=True, compute='_compute_current_meter') - current_read = fields.Float(string='本次读数') - unit_number = fields.Char(string='单元编号/用途') - gauge_magnification = fields.Integer(string='仪表倍率', readonly=True, default=1) - last_reading_time = fields.Date(string="最后读数时间") - type = fields.Selection([('public', '公共'), ('fees', '收费')], string='类型') - start_time = fields.Date(string="安装日期") - end_time = fields.Date(string="拆除日期") - water_state = fields.Selection([('stop', '停用'), ('use', '使用'), ('rent', '出租')], string='状态') - remarks = fields.Text(string='备注') - employee_ids = fields.Many2many('hr.employee', string='抄表人') - maximum_count = fields.Integer(string='最大位数') + water_id = fields.Many2one('property.meter.water', string='水表库', required=True, ondelete='cascade') + name = fields.Char(string='仪表编号') + epitope_values = fields.Char(string='表位置') + lessee_id = fields.Many2one('property.tenant.information', string='承租方', compute='_compute_lessee_id') + yuthon_property_ids = fields.Many2many('yuthon.property', string='物业信息') + last_meter = fields.Date(string='上次抄表日期') + last_dosage = fields.Float(string='上次用量', compute="_compute_last_dosage") + last_read = fields.Float(string='上次读数', readonly=True) + current_meter = fields.Float(string='本次用量', readonly=True, compute='_compute_current_meter') + current_read = fields.Float(string='本次读数') + unit_number = fields.Char(string='单元编号/用途') + gauge_magnification = fields.Integer(string='仪表倍率', readonly=True, default=1) + last_reading_time = fields.Date(string="最后读数时间") + type = fields.Selection([('public', '公共'), ('fees', '收费')], string='类型') + start_time = fields.Date(string="安装日期") + end_time = fields.Date(string="拆除日期") + water_state = fields.Selection([('stop', '停用'), ('use', '使用'), ('rent', '出租')], string='状态') + remarks = fields.Text(string='备注') + employee_ids = fields.Many2many('hr.employee', string='抄表人') + maximum_count = fields.Integer(string='最大位数') - @api.depends('current_read', 'last_read') - def _compute_current_meter(self): - for record in self: - record.current_meter = record.current_read - record.last_read + @api.depends('current_read', 'last_read') + def _compute_current_meter(self): + for record in self: + record.current_meter = record.current_read - record.last_read @api.depends('yuthon_property_ids') def _compute_lessee_id(self):