添加功能

This commit is contained in:
李鹏宇
2025-11-24 15:33:09 +08:00
parent 60d25b0deb
commit 21c72de22a
@@ -325,6 +325,26 @@ class PropertyBankStatements(models.Model):
}
}
def unbind(self):
statements_ids = self.env["property.bank.statements"].browse(
self._context.get('active_ids', self._context.get('active_id'))
)
for statement in statements_ids:
if statement.name:
bank_account = self.env['property.bank.line'].search([
('bank', '=', statement.name)
])
if bank_account.tenant_id:
# 获取需要删除的合同明细行
lines_to_delete = self.env['property.tenant.line'].search([
('tenant_id', '=', bank_account.tenant_id.id),
('lease_contract_id', 'in', statement.contract_ids.ids)
])
# 删除合同明细行
if lines_to_delete:
lines_to_delete.unlink()
statement.contract_ids = [(5,)]
def contract_penalty(self):
statements_ids = self.env['property.bank.statements'].search([('is_put', '=', True)])
for record in statements_ids: