添加功能
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user