From 808bd95424be0c0ede928142d06e4d16d9d4d847 Mon Sep 17 00:00:00 2001 From: hveficent Date: Wed, 25 Jul 2018 15:55:20 +0200 Subject: [PATCH] [MIG] bi_sql_editor: Migration to 11.0 --- bi_sql_editor/__init__.py | 1 - bi_sql_editor/__manifest__.py | 3 +-- bi_sql_editor/hooks.py | 1 - bi_sql_editor/models/__init__.py | 1 - bi_sql_editor/models/bi_sql_view.py | 6 +++--- bi_sql_editor/models/bi_sql_view_field.py | 3 +-- bi_sql_editor/tests/__init__.py | 1 - bi_sql_editor/tests/test_bi_sql_view.py | 4 +--- 8 files changed, 6 insertions(+), 14 deletions(-) diff --git a/bi_sql_editor/__init__.py b/bi_sql_editor/__init__.py index d040fb36..c09f841b 100644 --- a/bi_sql_editor/__init__.py +++ b/bi_sql_editor/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/bi_sql_editor/__manifest__.py b/bi_sql_editor/__manifest__.py index 9920f737..15795496 100644 --- a/bi_sql_editor/__manifest__.py +++ b/bi_sql_editor/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2017 - Today: GRAP (http://www.grap.coop) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -6,7 +5,7 @@ { 'name': 'BI SQL Editor', 'summary': 'BI Views builder, based on Materialized or Normal SQL Views', - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'license': 'AGPL-3', 'category': 'Reporting', 'author': 'GRAP,Odoo Community Association (OCA)', diff --git a/bi_sql_editor/hooks.py b/bi_sql_editor/hooks.py index 701d3dbd..ec2ecb6a 100644 --- a/bi_sql_editor/hooks.py +++ b/bi_sql_editor/hooks.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2015-2017 Onestein () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import SUPERUSER_ID diff --git a/bi_sql_editor/models/__init__.py b/bi_sql_editor/models/__init__.py index cc56bdca..e27e52a8 100644 --- a/bi_sql_editor/models/__init__.py +++ b/bi_sql_editor/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import bi_sql_view diff --git a/bi_sql_editor/models/bi_sql_view.py b/bi_sql_editor/models/bi_sql_view.py index 8eeefbf1..d6e3ec25 100644 --- a/bi_sql_editor/models/bi_sql_view.py +++ b/bi_sql_editor/models/bi_sql_view.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2017 - Today: GRAP (http://www.grap.coop) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -339,7 +338,8 @@ class BiSQLView(models.Model): return { 'name': _('Refresh Materialized View %s') % (self.view_name), 'user_id': SUPERUSER_ID, - 'model': 'bi.sql.view', + 'model_id': self.env['ir.model'].search([ + ('model', '=', self._name)], limit=1).id, 'function': '_refresh_materialized_view_cron', 'numbercall': -1, 'args': repr(([self.id],)) @@ -379,7 +379,7 @@ class BiSQLView(models.Model): 'model': self.model_id.model, 'arch': """""" - """{}""" + """{}""" """""".format("".join( [x._prepare_graph_field() for x in self.bi_sql_view_field_ids])) diff --git a/bi_sql_editor/models/bi_sql_view_field.py b/bi_sql_editor/models/bi_sql_view_field.py index 966ad6a6..14ea659d 100644 --- a/bi_sql_editor/models/bi_sql_view_field.py +++ b/bi_sql_editor/models/bi_sql_view_field.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2017 - Today: GRAP (http://www.grap.coop) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -130,7 +129,7 @@ class BiSQLViewField(models.Model): # Don't execute as simple .get() in the dict to manage # correctly the type 'character varying(x)' ttype = False - for k, v in self._SQL_MAPPING.iteritems(): + for k, v in self._SQL_MAPPING.items(): if k in vals['sql_type']: ttype = v diff --git a/bi_sql_editor/tests/__init__.py b/bi_sql_editor/tests/__init__.py index e01cc721..4382f405 100644 --- a/bi_sql_editor/tests/__init__.py +++ b/bi_sql_editor/tests/__init__.py @@ -1,3 +1,2 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_bi_sql_view diff --git a/bi_sql_editor/tests/test_bi_sql_view.py b/bi_sql_editor/tests/test_bi_sql_view.py index 13fda724..3e5223c8 100644 --- a/bi_sql_editor/tests/test_bi_sql_view.py +++ b/bi_sql_editor/tests/test_bi_sql_view.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 Onestein () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -40,11 +39,10 @@ class TestBiSqlViewEditor(SingleTransactionCase): def _create_user(cls, login, groups, company): """Create a user.""" user = cls.res_users.create({ - 'name': 'Test BI User', + 'name': login, 'login': login, 'password': 'demo', 'email': 'example@yourcompany.com', - 'notify_email': 'none', 'company_id': company.id, 'groups_id': [(6, 0, groups.ids)] })