From 81b577303bc5aa2d3f970dd886939ad8e9f37c35 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Mon, 21 May 2018 10:27:38 +0200 Subject: [PATCH] Test if journal has a sequence before getting a number from it As sequence is a required by context it may not be defined issue5502 review45121002 --- move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/move.py b/move.py index a4cf05c44d..897cf989fe 100644 --- a/move.py +++ b/move.py @@ -262,7 +262,8 @@ class Move(ModelSQL, ModelView): or Transaction().context.get('journal')) if journal_id: journal = Journal(journal_id) - vals['number'] = Sequence.get_id(journal.sequence.id) + if journal.sequence: + vals['number'] = Sequence.get_id(journal.sequence.id) moves = super(Move, cls).create(vlist) cls.validate_move(moves)