Browse Source

[MIG] bi_sql_editor: Migration to 11.0

pull/230/head
hveficent 6 years ago
parent
commit
7b840b168e
  1. 1
      .travis.yml
  2. 1
      bi_sql_editor/__init__.py
  3. 3
      bi_sql_editor/__manifest__.py
  4. 1
      bi_sql_editor/hooks.py
  5. 1
      bi_sql_editor/models/__init__.py
  6. 6
      bi_sql_editor/models/bi_sql_view.py
  7. 3
      bi_sql_editor/models/bi_sql_view_field.py
  8. 1
      bi_sql_editor/tests/__init__.py
  9. 4
      bi_sql_editor/tests/test_bi_sql_view.py
  10. 1
      oca_dependencies.txt

1
.travis.yml

@ -7,6 +7,7 @@ addons:
- expect-dev # provides unbuffer utility - expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow - python-lxml # because pip installation is slow
- pdftk - pdftk
postgresql: "9.3"
language: python language: python

1
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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models from . import models

3
bi_sql_editor/__manifest__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017 - Today: GRAP (http://www.grap.coop) # Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@ -6,7 +5,7 @@
{ {
'name': 'BI SQL Editor', 'name': 'BI SQL Editor',
'summary': 'BI Views builder, based on Materialized or Normal SQL Views', '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', 'license': 'AGPL-3',
'category': 'Reporting', 'category': 'Reporting',
'author': 'GRAP,Odoo Community Association (OCA)', 'author': 'GRAP,Odoo Community Association (OCA)',

1
bi_sql_editor/hooks.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2017 Onestein (<http://www.onestein.eu>) # Copyright 2015-2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import SUPERUSER_ID from odoo import SUPERUSER_ID

1
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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import bi_sql_view from . import bi_sql_view

6
bi_sql_editor/models/bi_sql_view.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2017 - Today: GRAP (http://www.grap.coop) # Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@ -339,7 +338,8 @@ class BiSQLView(models.Model):
return { return {
'name': _('Refresh Materialized View %s') % (self.view_name), 'name': _('Refresh Materialized View %s') % (self.view_name),
'user_id': SUPERUSER_ID, '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', 'function': '_refresh_materialized_view_cron',
'numbercall': -1, 'numbercall': -1,
'args': repr(([self.id],)) 'args': repr(([self.id],))
@ -379,7 +379,7 @@ class BiSQLView(models.Model):
'model': self.model_id.model, 'model': self.model_id.model,
'arch': 'arch':
"""<?xml version="1.0"?>""" """<?xml version="1.0"?>"""
"""<graph string="Analysis" type="pivot" stacked="True">{}"""
"""<graph string="Analysis" type="bar" stacked="True">{}"""
"""</graph>""".format("".join( """</graph>""".format("".join(
[x._prepare_graph_field() [x._prepare_graph_field()
for x in self.bi_sql_view_field_ids])) for x in self.bi_sql_view_field_ids]))

3
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) # Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # 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 # Don't execute as simple .get() in the dict to manage
# correctly the type 'character varying(x)' # correctly the type 'character varying(x)'
ttype = False ttype = False
for k, v in self._SQL_MAPPING.iteritems():
for k, v in self._SQL_MAPPING.items():
if k in vals['sql_type']: if k in vals['sql_type']:
ttype = v ttype = v

1
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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_bi_sql_view from . import test_bi_sql_view

4
bi_sql_editor/tests/test_bi_sql_view.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Onestein (<http://www.onestein.eu>) # Copyright 2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # 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): def _create_user(cls, login, groups, company):
"""Create a user.""" """Create a user."""
user = cls.res_users.create({ user = cls.res_users.create({
'name': 'Test BI User',
'name': login,
'login': login, 'login': login,
'password': 'demo', 'password': 'demo',
'email': 'example@yourcompany.com', 'email': 'example@yourcompany.com',
'notify_email': 'none',
'company_id': company.id, 'company_id': company.id,
'groups_id': [(6, 0, groups.ids)] 'groups_id': [(6, 0, groups.ids)]
}) })

1
oca_dependencies.txt

@ -0,0 +1 @@
server-tools https://github.com/Eficent/server-tools.git 11.0-mig-sql_request_abstract
Loading…
Cancel
Save