diff --git a/CHANGELOG b/CHANGELOG
index 65c86e116b..92665e3e8d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+* Prevent to change the type of journal with posted moves
* Mute reconciled payable/receivable lines
* Add delegated amount on move lines
* Enforce same type for children account as their parent
diff --git a/journal.py b/journal.py
index 1a3a582927..5af1c96d98 100644
--- a/journal.py
+++ b/journal.py
@@ -151,6 +151,25 @@ class Journal(
debit - credit)
return result
+ @classmethod
+ def write(cls, *args):
+ pool = Pool()
+ Move = pool.get('account.move')
+ actions = iter(args)
+ for journals, values in zip(actions, actions):
+ if 'type' in values:
+ for sub_journals in grouped_slice(journals):
+ moves = Move.search([
+ ('journal', 'in', [j.id for j in sub_journals]),
+ ('state', '=', 'posted')
+ ], order=[], limit=1)
+ if moves:
+ move, = moves
+ raise AccessError(gettext(
+ 'account.msg_journal_account_moves',
+ journal=move.journal.rec_name))
+ super().write(*args)
+
class JournalSequence(ModelSQL, CompanyValueMixin):
"Journal Sequence"
diff --git a/message.xml b/message.xml
index da6c47bc71..28dc059e48 100644
--- a/message.xml
+++ b/message.xml
@@ -234,5 +234,8 @@ You may need to cancel its move "%(move)s".
To close period "%(period)s", you must balance the inactive account "%(account)s".
+
+ You cannot change the type of journal "%(journal)s" because it has posted moves.
+