diff --git a/modules/account/message.xml b/modules/account/message.xml index 53df826188..2e770939e8 100644 --- a/modules/account/message.xml +++ b/modules/account/message.xml @@ -149,6 +149,10 @@ Use the current period to cancel the move? The reconciliation "%(reconciliation)s" is delegated to the line "%(line)s". +You may need to cancel its move "%(move)s". + + + The reconciliation "%(reconciliation)s" is linked to the write-off line "%(line)s". You may need to cancel its move "%(move)s". diff --git a/modules/account/move.py b/modules/account/move.py index 52af7d8a92..7d55b87139 100644 --- a/modules/account/move.py +++ b/modules/account/move.py @@ -609,6 +609,16 @@ class Reconciliation(ModelSQL, ModelView): reconciliation=reconciliation.rec_name, line=reconciliation.delegate_to.rec_name, move=reconciliation.delegate_to.move.rec_name)) + for line in reconciliation.lines: + if line.move.journal.type == 'write-off': + key = Warning.format('delete.write-off', [reconciliation]) + if Warning.check(key): + raise ReconciliationDeleteWarning(key, + gettext( + 'account.msg_reconciliation_delete_write_off', + reconciliation=reconciliation.rec_name, + line=line.rec_name, + move=line.move.rec_name)) super().delete(reconciliations) @classmethod