From 1af4c64194f69b570426c3330f4d095e9a631475 Mon Sep 17 00:00:00 2001 From: Andrea Stirpe Date: Fri, 8 Jul 2016 16:54:39 +0200 Subject: [PATCH] [FIX] Remove use of cr.commit() directly --- bi_view_editor/models/bve_view.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bi_view_editor/models/bve_view.py b/bi_view_editor/models/bve_view.py index e70f9fa1..affaa354 100644 --- a/bi_view_editor/models/bve_view.py +++ b/bi_view_editor/models/bve_view.py @@ -255,10 +255,14 @@ class BveView(models.Model): [x for x in self.name.lower() if x.isalnum()]).replace("_", ".").replace(" ", ".") - _build_query() - obj = _build_object() - _build_access_rules(obj) - self.env.cr.commit() + try: + with self.env.cr.savepoint(): + _build_query() + obj = _build_object() + _build_access_rules(obj) + except Exception, e: + raise UserError( + _('Generic error. Unable to create the view!')) from openerp.modules.registry import RegistryManager self.env.registry = RegistryManager.new(self.env.cr.dbname)