@@ -310,8 +310,8 @@ class MeterArchivesLine(models.Model):
|
||||
i.last_meter = i.meter_date
|
||||
i.current_meter = 0
|
||||
|
||||
@api.constrains('current_read', 'last_read', 'maximum_count')
|
||||
def _check_reading_consistency(self):
|
||||
@api.onchagne('current_read', 'last_read', 'maximum_count')
|
||||
def onchange_current_meter(self):
|
||||
for record in self:
|
||||
if record.last_read is not None and record.current_read is not None and record.last_read > 0:
|
||||
if record.current_read < record.last_read:
|
||||
|
||||
@@ -285,8 +285,8 @@ class MeterWaterLine(models.Model):
|
||||
i.last_meter = i.meter_date
|
||||
i.current_meter = 0
|
||||
|
||||
@api.constrains('current_read', 'last_read', 'maximum_count')
|
||||
def _check_reading_consistency(self):
|
||||
@api.onchange('current_read', 'last_read', 'maximum_count')
|
||||
def onchange_current_meter(self):
|
||||
for record in self:
|
||||
if record.last_read is not None and record.current_read is not None and record.last_read > 0:
|
||||
if record.current_read < record.last_read:
|
||||
|
||||
@@ -52,7 +52,7 @@ class ElectricWaterWizard(models.TransientModel):
|
||||
'type': meter.type,
|
||||
'archives_state': meter.archives_state,
|
||||
'maximum_count': meter.maximum_count,
|
||||
'contract_id': contract_line.lease_id if contract_line else False,
|
||||
'contract_id': contract_line.lease_id.id if contract_line and contract_line.lease_id else False,
|
||||
})
|
||||
|
||||
# 处理水表推送
|
||||
@@ -93,5 +93,5 @@ class ElectricWaterWizard(models.TransientModel):
|
||||
'type': water.type,
|
||||
'water_state': water.water_state,
|
||||
'maximum_count': water.maximum_count,
|
||||
'contract_id': contract_line.lease_id if contract_line else False,
|
||||
'contract_id': contract_line.lease_id.id if contract_line and contract_line.lease_id else False,
|
||||
})
|
||||
|
||||
@@ -157,8 +157,6 @@ class PropertyBankStatements(models.Model):
|
||||
record.admin_id = record.contract_ids[0].admin_id.id if record.contract_ids[0].admin_id else False
|
||||
record.lessee_ids = [(6, 0, list(lessee_set))] if lessee_set else [(5, 0, 0)]
|
||||
|
||||
|
||||
|
||||
def update_property_name(self):
|
||||
property_ids = self.env["property.bank.statements"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
@@ -230,6 +228,23 @@ class PropertyBankStatements(models.Model):
|
||||
self.no_amount = self.original_amount
|
||||
self.yes_amount = 0
|
||||
self.reconciliation_time = None
|
||||
self._filter_contracts_based_on_receivables()
|
||||
|
||||
def _filter_contracts_based_on_receivables(self):
|
||||
"""筛选合同:仅保留存在未对账应收单的合同"""
|
||||
for stmt in self:
|
||||
if not stmt.contract_ids:
|
||||
continue
|
||||
remaining_contract_ids = []
|
||||
for contract in stmt.contract_ids:
|
||||
unreconciled_receivables = self.env["property.accounts.receivable"].search([
|
||||
('contract_id', '=', contract.id),
|
||||
('is_reconciliation', '=', False),
|
||||
], limit=1)
|
||||
if unreconciled_receivables:
|
||||
remaining_contract_ids.append(contract.id)
|
||||
if remaining_contract_ids != stmt.contract_ids.ids:
|
||||
stmt.contract_ids = [(6, 0, remaining_contract_ids)]
|
||||
|
||||
def binding_information(self):
|
||||
return {
|
||||
|
||||
@@ -627,7 +627,7 @@
|
||||
<button name="other" type="object" class="oe_highlight" string="其他"/>
|
||||
</header>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name_account']" position="after">
|
||||
<xpath expr="//field[@name='original_amount']" position="after">
|
||||
<field name="lessee_ids" widget="many2many_tags" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='property_ids']" position="before">
|
||||
|
||||
@@ -30,7 +30,7 @@ class PropertyReconciliationWizard(models.Model):
|
||||
for rec in self:
|
||||
rec.amount_reconciled = rec.actual_total - rec.amount_been_reconciled - sum(line.amount for line in rec.reconciliation_line_ids)
|
||||
for line in rec.reconciliation_line_ids:
|
||||
if line.rent_month == line.amount:
|
||||
if line.rent_month == line.amount and line.collection_type == 'rent':
|
||||
line.remake = str(rec.actual_date) + '补' + str(line.due_date)
|
||||
|
||||
@api.depends('reconciliation_line_ids')
|
||||
@@ -483,6 +483,23 @@ class PropertyReconciliationWizard(models.Model):
|
||||
rec.bank_id.no_amount = amount_reconciled
|
||||
|
||||
|
||||
# 更新流水的合同信息
|
||||
remaining_contract_ids = []
|
||||
for contract in self.bank_id.contract_ids:
|
||||
unreconciled_receivables = self.env["property.accounts.receivable"].search([
|
||||
('contract_id', '=', contract.id),
|
||||
('is_reconciliation', '=', False),
|
||||
], limit=1)
|
||||
|
||||
# 核心逻辑:存在未对账应收单 → 保留合同;否则 → 移除
|
||||
if unreconciled_receivables:
|
||||
remaining_contract_ids.append(contract.id)
|
||||
|
||||
bank_ids = self.env["property.bank.statements"].search([('name', '=', self.bank_id.name)])
|
||||
for rec in bank_ids:
|
||||
if remaining_contract_ids != rec.contract_ids.ids:
|
||||
rec.contract_ids = [(6, 0, remaining_contract_ids)]
|
||||
|
||||
|
||||
class PropertyReconciliationLine(models.Model):
|
||||
_name = 'property.reconciliation.line'
|
||||
|
||||
Reference in New Issue
Block a user