Prevent setting move back to draft in a closed period

review527003
This commit is contained in:
Nicolas Évrard committed 2012-09-21 15:57:18 +02:00
1 parent 0c6e3ee574
commit 940b950d8a
1 file changed
+4
+4
View File
@@ -77,6 +77,8 @@ class Move(ModelSQL, ModelView):
'of different companies in the same move!',
'date_outside_period': 'You can not create move ' \
'with a date outside the period!',
'draft_closed_period': 'You can not set to draft a move ' \
'from a closed period',
})
self._buttons.update({
'post': {
@@ -358,6 +360,8 @@ class Move(ModelSQL, ModelView):
for move in self.browse(ids):
if not move.journal.update_posted:
self.raise_user_error('draft_posted_move_journal')
if move.period.state == 'close':
self.raise_user_error('draft_closed_period')
return self.write(ids, {
'state': 'draft',
})