[add] statement cancel line: ask for confirmation if the line is reconciled

This commit is contained in:
Leonardo Pistone
2014-01-27 12:30:24 +01:00
parent 0b6d8c85be
commit 060862248e
7 changed files with 116 additions and 1 deletions

View File

@@ -97,6 +97,28 @@ class StatementLine(orm.Model):
return res
def button_cancel(self, cr, uid, ids, context=None):
"""Check if a line is reconciled, and cancel it. Return action."""
if context is None:
context = {}
for st_line in self.browse(cr, uid, ids, context=context):
for move in st_line.move_ids:
for move_line in move.line_id:
if move_line.reconcile:
# ask confirmation, we have some reconciliation already
return {
'type': 'ir.actions.act_window',
'res_model': 'wizard.cancel.line',
'view_type': 'form',
'view_mode': 'form',
'target': 'new',
'context': context,
}
# no reconciliation to worry about: we cancel our lines directly then
return self.cancel(cr, uid, ids, context=context)
def cancel(self, cr, uid, ids, context=None):
"""Cancel one statement line, return action.