Reviewers: ,


Please review this at http://codereview.tryton.org/808002/

Affected files:
  M move.py


Index: move.py
===================================================================

--- a/move.py
+++ b/move.py
@@ -89,6 +89,8 @@
                     'because it\'s date is outside its period.'),
                 'draft_closed_period': ('You can not set to draft move '
                     '"%(move)s" because period "%(period)s" is closed.'),
+ 'journal_empty_sequence': ('You can add a sequence in "%s" '
+                    'journal because it is empty.'),
                 })
         cls._buttons.update({
                 'post': {
@@ -242,6 +244,9 @@
                         or Transaction().context.get('journal'))
                 if journal_id:
                     journal = Journal(journal_id)
+                    if not journal.sequence:
+                        cls.raise_user_error('journal_empty_sequence',
+                            (journal.rec_name,))
                     vals['number'] = Sequence.get_id(journal.sequence.id)

         moves = super(Move, cls).create(vlist)



Reply via email to