diff options
| author | Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com> | 2012-10-26 11:12:42 +0200 |
|---|---|---|
| committer | Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com> | 2012-10-26 11:12:42 +0200 |
| commit | eaf53213da2ba6bb0e620d8eadc58e33016e2aaa (patch) | |
| tree | 2446c7fc0e777ffb4b97e9924b10ca7294939569 | |
| parent | 8132259454bf6b19b9f740510a21cf087a112dff (diff) | |
[IMP] Forbid the user to delete any move linked to an invoice. Cancelling invoice still work obviously
bzr revid: joel.grandguillaume@camptocamp.com-20121026091242-9fu2a4do0ra50fqu
| -rw-r--r-- | addons/account/account.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/account/account.py b/addons/account/account.py index f3ba38fee8d..330e3f2d742 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1485,6 +1485,11 @@ class account_move(osv.osv): raise osv.except_osv(_('User Error!'), _('You cannot delete a posted journal entry "%s".') % \ move['name']) + for line in move.line_id: + if line.invoice: + raise osv.except_osv(_('User Error!'), + _("Move cannot be deleted if linked to an invoice: %s : Move ID:%s.") % \ + (line.invoice.number,move.name)) line_ids = map(lambda x: x.id, move.line_id) context['journal_id'] = move.journal_id.id context['period_id'] = move.period_id.id |
