any函数:
any(x),只要x中有一个不为空,0,false就返回True,否则返回False
all(x)函数
必须x中的所有元素均不为空,0,false才会返回True,否则返回False
if any(bool(rec.move_line_ids) for rec in self):
raise UserError(_("You cannot delete a payment that is already posted."))
if any(rec.move_name for rec in self):
raise UserError(_('It is not allowed to delete a payment that already created a journal entry since it would create a gap in the numbering. You should create the journal entry again and cancel it thanks to a regular revert.'))
return super(account_payment, self).unlink()