From 1bfdbd0eb9c48de7e728cf40d7d4a84dd753bf2e Mon Sep 17 00:00:00 2001 From: vrenaville Date: Fri, 30 Oct 2015 14:13:59 +0100 Subject: [PATCH] [FIX] add api constraints --- account_move_locking/wizard/account_lock_account_move.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/account_move_locking/wizard/account_lock_account_move.py b/account_move_locking/wizard/account_lock_account_move.py index 0a87cb8d4..ee18afee6 100644 --- a/account_move_locking/wizard/account_lock_account_move.py +++ b/account_move_locking/wizard/account_lock_account_move.py @@ -34,11 +34,15 @@ class lock_account_move(models.TransientModel): date_end = fields.Datetime(string='Date end', required=True) - @api.multi - def lock_move(self, data): + @api.one + @api.constrains('date_start', 'date_end') + def _check_date_stop_start(self): if self.date_start > self.date_end: raise exceptions.UserError(_('Date start need to be \ before Date end')) + + @api.multi + def lock_move(self, data): obj_move = self.env['account.move'] draft_move = obj_move.search([('state', '=', 'draft'), ('journal_id',