Merge pull request !5982 from 李鹏宇/dev
This commit is contained in:
@@ -468,8 +468,7 @@ class PropertyBankStatements(models.Model):
|
||||
"dialog_size": "extra-large",
|
||||
"default_order": "due_date desc",
|
||||
}
|
||||
# 未知逻辑忘记可能要补充,只能依次对账
|
||||
# self._check_unreconciled_statements(start_time)
|
||||
self._check_unreconciled_statements(start_time)
|
||||
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
@@ -481,33 +480,32 @@ class PropertyBankStatements(models.Model):
|
||||
"context": context,
|
||||
}
|
||||
|
||||
# def _check_unreconciled_statements(self, current_transaction_time):
|
||||
# """
|
||||
# 检查所有承租方对应的银行账号在property.bank.statements中是否有未对账流水
|
||||
# :param current_transaction_time: 当前交易时间(带时区处理后)
|
||||
# """
|
||||
# if not self.lessee_ids:
|
||||
# return
|
||||
# bank_accounts = self.env['property.bank.line'].search([
|
||||
# ('tenant_id', 'in', self.lessee_ids.ids)
|
||||
# ]).mapped('bank')
|
||||
# bank_accounts = [acc for acc in bank_accounts if acc] # 过滤空值
|
||||
# if not bank_accounts:
|
||||
# return
|
||||
# unreconciled = {}
|
||||
# for account in bank_accounts:
|
||||
# # 查询条件:同账号 + 交易时间早于当前 + 未对账
|
||||
# statements = self.env['property.bank.statements'].search([
|
||||
# ('name', '=', account),
|
||||
# ('start_time', '<', current_transaction_time),
|
||||
# ('bank_state', '=', 'not_reconciled'),
|
||||
# ('id', '!=', self.id),
|
||||
# ])
|
||||
# if statements:
|
||||
# unreconciled[account] = len(statements)
|
||||
#
|
||||
# if unreconciled:
|
||||
# raise UserError("存在未对账的历史流水,请优先处理")
|
||||
def _check_unreconciled_statements(self, current_transaction_time):
|
||||
"""
|
||||
检查所有承租方对应的银行账号在property.bank.statements中是否有未对账流水
|
||||
:param current_transaction_time: 当前交易时间(带时区处理后)
|
||||
"""
|
||||
if not self.lessee_ids:
|
||||
return
|
||||
bank_accounts = self.env['property.bank.line'].search([
|
||||
('tenant_id', 'in', self.lessee_ids.ids)
|
||||
]).mapped('bank')
|
||||
bank_accounts = [acc for acc in bank_accounts if acc] # 过滤空值
|
||||
if not bank_accounts:
|
||||
return
|
||||
unreconciled = {}
|
||||
for account in bank_accounts:
|
||||
# 查询条件:同账号 + 交易时间早于当前 + 未对账
|
||||
statements = self.env['property.bank.statements'].search([
|
||||
('name', '=', account),
|
||||
('start_time', '<', current_transaction_time),
|
||||
('bank_state', '=', 'not_reconciled'),
|
||||
('id', '!=', self.id),
|
||||
])
|
||||
if statements:
|
||||
unreconciled[account] = len(statements)
|
||||
if unreconciled:
|
||||
raise UserError("存在未对账的历史流水,请优先处理:")
|
||||
|
||||
def button_reconciliation(self):
|
||||
for record in self:
|
||||
|
||||
@@ -49,10 +49,10 @@
|
||||
<field name="sequence" column_invisible="1" />
|
||||
<field name="reconciliation_id" column_invisible="1"/>
|
||||
<field name="property_ids" readonly="1" column_invisible="1"/>
|
||||
<field name="collection_type" readonly="1" force_save="1"/>
|
||||
<field name="property_name"/>
|
||||
<field name="contract_id" readonly="1" force_save="1"/>
|
||||
<field name="property_name"/>
|
||||
<field name="due_date" readonly="1" force_save="1"/>
|
||||
<field name="collection_type" readonly="1" force_save="1"/>
|
||||
<field name="rent_month" sum = "Total" readonly="1" force_save="1"/>
|
||||
<field name="rent" sum = "Total" readonly="1" force_save="1"/>
|
||||
<field name="amount" sum = "Total" force_save="1"/>
|
||||
|
||||
Reference in New Issue
Block a user