From aabecae43c614f4d86898e021f5be29099e0177f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 14 Apr 2009 17:01:07 +0200 Subject: [PATCH] Fix order of operation on periods for issue979 --- fiscalyear.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fiscalyear.py b/fiscalyear.py index 8b2b20ba72..021c793102 100644 --- a/fiscalyear.py +++ b/fiscalyear.py @@ -112,6 +112,12 @@ class FiscalYear(ModelSQL, ModelView): vals['post_move_sequence']: self.raise_user_error(cursor, 'change_post_move_sequence', context=context) + vals = vals.copy() + if 'periods' in vals: + operator = ['delete', 'unlink_all', 'unlink', 'create', 'write', + 'add', 'set'] + vals['periods'].sort( + lambda x, y: cmp(operator.index(x[0]), operator.index(y[0]))) return super(FiscalYear, self).write(cursor, user, ids, vals, context=context)