添加功能

This commit is contained in:
李鹏宇
2025-09-28 18:19:17 +08:00
parent bffa95d571
commit bd6b22d74d
6 changed files with 21 additions and 30 deletions
@@ -24,7 +24,6 @@ class PropertyMeterArchives(models.Model):
other = fields.Char(string='其他')
unit = fields.Float(string='当月单价')
archives_state = fields.Selection([('stop', '停用'), ('use', '正常'), ('rent', '出租')], string='状态', compute='_compute_archives_state', store=True, default='use')
is_push = fields.Boolean(string='已推送')
start_time = fields.Date(string="安装日期")
end_time = fields.Date(string="拆除日期")
line_loss = fields.Float(string="线损", default=0.02)
@@ -22,7 +22,6 @@ class PropertyMeterWater(models.Model):
epitope_values_id = fields.Many2one('yuthon.epitope.values', string='表位置')
other = fields.Char(string='其他')
unit = fields.Float(string='当月单价')
is_push = fields.Boolean(string='已推送')
start_time = fields.Date(string="安装日期")
end_time = fields.Date(string="拆除日期")
line_loss = fields.Float(string="线损", default=0.05)
@@ -139,11 +138,11 @@ class MeterWaterLine(models.Model):
last_read = fields.Float(string='上次读数')
meter_date = fields.Date(string='任务日期')
current_meter = fields.Float(string='本次用量', readonly=True, compute='compute_meter_values')
current_read = fields.Float(string='本次读数')
current_read = fields.Float(string='本次读数', group_operator=None)
unit_number = fields.Char(string='单元编号/用途')
unit = fields.Float(string='当月单价')
receivables = fields.Float(string="应收", compute='_compute_receivables', store=True)
gauge_magnification = fields.Integer(string='仪表倍率', readonly=True, default=1)
gauge_magnification = fields.Integer(string='仪表倍率', readonly=True, default=1, group_operator=None)
last_reading_time = fields.Date(string="最后读数时间")
type = fields.Selection([('public', '公共'), ('fees', '收费')], string='类型')
start_time = fields.Date(string="安装日期")
@@ -4,7 +4,7 @@
<field name="name">property.meter.archives.tree</field>
<field name="model">property.meter.archives</field>
<field name="arch" type="xml">
<tree string="电表库" create="False" editable="bottom" decoration-success="is_push"
<tree string="电表库" create="False" editable="bottom"
decoration-danger="archives_state == 'stop'">
<header>
<button class="oe_highlight" name="batch_reading_push" string="推送" type="object"/>
@@ -24,7 +24,6 @@
<field name="end_time"/>
<field name="remarks"/>
<field name="archives_state"/>
<field name="is_push" column_invisible="1"/>
<field name="maximum_count"/>
<button name="open_record" string="详情" type="object" class="oe_highlight"/>
</tree>
@@ -57,7 +56,6 @@
<field name="start_time"/>
<field name="end_time"/>
<field name="archives_state"/>
<field name="is_push" invisible="1"/>
<field name="remarks"/>
</group>
</group>
@@ -5,8 +5,7 @@
<field name="model">property.meter.water</field>
<field name="arch" type="xml">
<tree string="水表库" create="False" editable="bottom"
decoration-danger="water_state == 'stop'"
decoration-success="is_push" >
decoration-danger="water_state == 'stop'">
<header>
<button class="oe_highlight" name="batch_reading_water_push" string="推送" type="object"/>
<button class="oe_highlight" name="button_water_state" string="停用" type="object"/>
@@ -25,7 +24,6 @@
<field name="end_time"/>
<field name="water_state"/>
<field name="remarks"/>
<field name="is_push" column_invisible="1"/>
<field name="employee_ids" widget="many2many_tags" options="{'no_create': True}"/>
<field name="maximum_count"/>
<button name="open_record" string="详情" type="object" class="oe_highlight"/>
@@ -60,7 +58,6 @@
<field name="start_time"/>
<field name="end_time"/>
<field name="water_state"/>
<field name="is_push" invisible="1"/>
<field name="remarks"/>
</group>
</group>
@@ -97,6 +97,6 @@ class ElectricWaterWizard(models.TransientModel):
'type': water.type,
'start_time': water.start_time,
'end_time': water.end_time,
'archives_state': water.archives_state,
'water_state': water.water_state,
'maximum_count': water.maximum_count,
})
@@ -425,24 +425,6 @@ class PropertyAccountsReceivable(models.Model):
})
contract_account.onchange_contract_id()
@api.model_create_multi
def create(self, vals_list):
contract_account_map = {}
for vals in vals_list:
if 'contract_id' in vals and vals['contract_id']:
contract_id = vals['contract_id']
if contract_id not in contract_account_map:
contract_account = self.env['contract.accounts.receivable'].search([
('contract_id', '=', contract_id)
], limit=1)
if not contract_account:
contract_account = self.env['contract.accounts.receivable'].create({
'contract_id': contract_id
})
else:
contract_account.onchange_contract_id()
contract_account.onchange_contract_id()
@api.depends('management_type_id')
def _compute_is_rent(self):
for rec in self:
@@ -591,6 +573,22 @@ class PropertyAccountsReceivable(models.Model):
'property_ids': property_ids_value,
'contract_ids': contract_id_value,
})
contract_account_map = {}
for vals in vals_list:
if 'contract_id' in vals and vals['contract_id']:
contract_id = vals['contract_id']
if contract_id not in contract_account_map:
contract_account = self.env['contract.accounts.receivable'].search([
('contract_id', '=', contract_id)
], limit=1)
if not contract_account:
contract_account = self.env['contract.accounts.receivable'].create({
'contract_id': contract_id
})
else:
contract_account.onchange_contract_id()
contract_account.onchange_contract_id()
return records
@api.onchange('penalty_date')