diff --git a/mis_builder/CHANGES.rst b/mis_builder/CHANGES.rst index 9576a4f4..ec400fb8 100644 --- a/mis_builder/CHANGES.rst +++ b/mis_builder/CHANGES.rst @@ -6,11 +6,17 @@ Changelog .. .. * +10.0.2.0.3 (2017-01-10) +~~~~~~~~~~~~~~~~~~~~~~ + +* [IMP] use fontawesome icons +* [MIG] migrate to 10.0 + 9.0.2.0.2 (2016-09-27) ~~~~~~~~~~~~~~~~~~~~~~ * [IMP] Add refresh button in mis report preview. - Widget code changes to allow to add fields in the widget easier + Widget code changes to allow to add fields in the widget easier 9.0.2.0.1 (2016-05-26) ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/mis_builder/README.rst b/mis_builder/README.rst index 4ea2e57d..c9d14826 100644 --- a/mis_builder/README.rst +++ b/mis_builder/README.rst @@ -44,11 +44,7 @@ To configure this module, you need to: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/91/8.0 - -For further information, please visit: - -* https://www.odoo.com/forum/help-1 + :target: https://runbot.odoo-community.org/runbot/91/10.0 Developer notes =============== diff --git a/mis_builder/__manifest__.py b/mis_builder/__manifest__.py index 0b7ce378..d0355f0a 100644 --- a/mis_builder/__manifest__.py +++ b/mis_builder/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'MIS Builder', - 'version': '9.0.2.0.2', + 'version': '10.0.2.0.2', 'category': 'Reporting', 'summary': """ Build 'Management Information System' Reports and Dashboards @@ -14,10 +14,10 @@ 'website': 'http://acsone.eu', 'depends': [ 'account', + 'board', 'report_xlsx', # OCA/reporting-engine 'date_range', # OCA/server-tools - # TODO uncomment when https://github.com/OCA/web/pull/270 is merged - # 'web_widget_color', # OCA/web + 'web_widget_color', # OCA/web ], 'data': [ 'wizard/mis_builder_dashboard.xml', @@ -40,7 +40,7 @@ 'qweb': [ 'static/src/xml/*.xml' ], - 'installable': False, + 'installable': True, 'application': True, 'license': 'AGPL-3', } diff --git a/mis_builder/datas/ir_cron.xml b/mis_builder/datas/ir_cron.xml index 199770c8..800020e2 100644 --- a/mis_builder/datas/ir_cron.xml +++ b/mis_builder/datas/ir_cron.xml @@ -1,5 +1,5 @@ - + @@ -15,4 +15,4 @@ - + diff --git a/mis_builder/models/aep.py b/mis_builder/models/aep.py index 25f8970d..b79276c7 100644 --- a/mis_builder/models/aep.py +++ b/mis_builder/models/aep.py @@ -6,10 +6,10 @@ import re from collections import defaultdict from itertools import izip -from openerp import fields -from openerp.models import expression -from openerp.tools.safe_eval import safe_eval -from openerp.tools.float_utils import float_is_zero +from odoo import fields +from odoo.models import expression +from odoo.tools.safe_eval import safe_eval +from odoo.tools.float_utils import float_is_zero from .accounting_none import AccountingNone diff --git a/mis_builder/models/mis_report.py b/mis_builder/models/mis_report.py index 7068afbf..c6ecc64a 100644 --- a/mis_builder/models/mis_report.py +++ b/mis_builder/models/mis_report.py @@ -12,9 +12,9 @@ import time import pytz -from openerp import api, fields, models, _ -from openerp.exceptions import UserError -from openerp.tools.safe_eval import safe_eval +from odoo import api, fields, models, _ +from odoo.exceptions import UserError +from odoo.tools.safe_eval import safe_eval from .aep import AccountingExpressionProcessor as AEP from .aggregate import _sum, _avg, _min, _max @@ -159,8 +159,7 @@ class KpiMatrix(object): def __init__(self, env): # cache language id for faster rendering lang_model = env['res.lang'] - lang_id = lang_model._lang_get(env.user.lang) - self.lang = lang_model.browse(lang_id) + self.lang = lang_model._lang_get(env.user.lang) self._style_model = env['mis.report.style'] self._account_model = env['account.account'] # data structures @@ -281,7 +280,7 @@ class KpiMatrix(object): col = self._cols[col_key] base_col = self._cols[base_col_key] common_subkpis = set(col.subkpis) & set(base_col.subkpis) - if not common_subkpis: + if (col.subkpis or base_col.subkpis) and not common_subkpis: raise UserError('Columns {} and {} are not comparable'. format(col.description, base_col.description)) @@ -296,15 +295,19 @@ class KpiMatrix(object): if cell_tuple is None and base_cell_tuple is None: continue if cell_tuple is None: - vals = [AccountingNone] * len(common_subkpis) + vals = [AccountingNone] * \ + (len(common_subkpis) or 1) else: vals = [cell.val for cell in cell_tuple - if cell.subcol.subkpi in common_subkpis] + if not common_subkpis or + cell.subcol.subkpi in common_subkpis] if base_cell_tuple is None: - base_vals = [AccountingNone] * len(common_subkpis) + base_vals = [AccountingNone] * \ + (len(common_subkpis) or 1) else: base_vals = [cell.val for cell in base_cell_tuple - if cell.subcol.subkpi in common_subkpis] + if not common_subkpis or + cell.subcol.subkpi in common_subkpis] comparison_cell_tuple = [] for val, base_val, comparison_subcol in \ izip(vals, diff --git a/mis_builder/models/mis_report_instance.py b/mis_builder/models/mis_report_instance.py index 5d111b83..7178fa08 100644 --- a/mis_builder/models/mis_report_instance.py +++ b/mis_builder/models/mis_report_instance.py @@ -2,7 +2,7 @@ # © 2014-2016 ACSONE SA/NV () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models, _ +from odoo import api, fields, models, _ import datetime import logging @@ -264,8 +264,8 @@ class MisReportInstance(models.Model): def _format_date(self, date): # format date following user language lang_model = self.env['res.lang'] - lang_id = lang_model._lang_get(self.env.user.lang) - date_format = lang_model.browse(lang_id).date_format + lang = lang_model._lang_get(self.env.user.lang) + date_format = lang.date_format return datetime.datetime.strftime( fields.Date.from_string(date), date_format) diff --git a/mis_builder/models/mis_report_style.py b/mis_builder/models/mis_report_style.py index 20fb236f..32c80491 100644 --- a/mis_builder/models/mis_report_style.py +++ b/mis_builder/models/mis_report_style.py @@ -3,8 +3,8 @@ # © 2016 ACSONE SA/NV () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models, _ -from openerp.exceptions import UserError +from odoo import api, fields, models, _ +from odoo.exceptions import UserError from .accounting_none import AccountingNone from .data_error import DataError diff --git a/mis_builder/models/mis_safe_eval.py b/mis_builder/models/mis_safe_eval.py index 995ff76c..180ab2f9 100644 --- a/mis_builder/models/mis_safe_eval.py +++ b/mis_builder/models/mis_safe_eval.py @@ -4,7 +4,7 @@ import traceback -from openerp.tools.safe_eval import test_expr, _SAFE_OPCODES, _BUILTINS +from odoo.tools.safe_eval import test_expr, _SAFE_OPCODES, _BUILTINS from .data_error import DataError, NameDataError diff --git a/mis_builder/report/mis_report_instance_qweb.py b/mis_builder/report/mis_report_instance_qweb.py index 162b146a..54f5c47a 100644 --- a/mis_builder/report/mis_report_instance_qweb.py +++ b/mis_builder/report/mis_report_instance_qweb.py @@ -4,7 +4,7 @@ import logging -from openerp import api, models +from odoo import api, models _logger = logging.getLogger(__name__) @@ -12,16 +12,13 @@ _logger = logging.getLogger(__name__) class Report(models.Model): _inherit = "report" - @api.v7 - def get_pdf(self, cr, uid, ids, report_name, html=None, data=None, - context=None): - if ids: - report = self._get_report_from_name(cr, uid, report_name) - obj = self.pool[report.model].browse(cr, uid, ids, - context=context)[0] - context = context.copy() + @api.model + def get_pdf(self, docids, report_name, html=None, data=None): + if docids: + report = self._get_report_from_name(report_name) + obj = self.env[report.model].browse(docids)[0] + ctx = self.env.context.copy() if hasattr(obj, 'landscape_pdf') and obj.landscape_pdf: - context.update({'landscape': True}) - return super(Report, self).get_pdf(cr, uid, ids, report_name, - html=html, data=data, - context=context) + ctx.update({'landscape': True}) + return super(Report, self.with_context(ctx)).get_pdf( + docids, report_name, html=html, data=data) diff --git a/mis_builder/report/mis_report_instance_qweb.xml b/mis_builder/report/mis_report_instance_qweb.xml index 769034bc..48e5bb90 100644 --- a/mis_builder/report/mis_report_instance_qweb.xml +++ b/mis_builder/report/mis_report_instance_qweb.xml @@ -1,5 +1,5 @@ - + @@ -86,4 +86,4 @@ - + diff --git a/mis_builder/report/mis_report_instance_xlsx.py b/mis_builder/report/mis_report_instance_xlsx.py index ecfa470b..bc0940cb 100644 --- a/mis_builder/report/mis_report_instance_xlsx.py +++ b/mis_builder/report/mis_report_instance_xlsx.py @@ -5,7 +5,7 @@ from collections import defaultdict import logging -from openerp.report import report_sxw +from odoo.report import report_sxw from ..models.accounting_none import AccountingNone from ..models.data_error import DataError @@ -13,7 +13,7 @@ from ..models.data_error import DataError _logger = logging.getLogger(__name__) try: - from openerp.addons.report_xlsx.report.report_xlsx import ReportXlsx + from odoo.addons.report_xlsx.report.report_xlsx import ReportXlsx except ImportError: _logger.debug("report_xlsx not installed, Excel export non functional") diff --git a/mis_builder/report/mis_report_instance_xlsx.xml b/mis_builder/report/mis_report_instance_xlsx.xml index e3695648..77d7c40c 100644 --- a/mis_builder/report/mis_report_instance_xlsx.xml +++ b/mis_builder/report/mis_report_instance_xlsx.xml @@ -1,5 +1,5 @@ - + @@ -12,4 +12,4 @@ - + diff --git a/mis_builder/security/ir.model.access.csv b/mis_builder/security/ir.model.access.csv index f6ee127c..8d8b87df 100644 --- a/mis_builder/security/ir.model.access.csv +++ b/mis_builder/security/ir.model.access.csv @@ -13,5 +13,5 @@ manage_mis_report_subkpi,access_mis_report_subkpi,model_mis_report_subkpi,accoun access_mis_report_subkpi,access_mis_report_subkpi,model_mis_report_subkpi,base.group_user,1,0,0,0 manage_mis_report_kpi_expression,access_mis_report_kpi_expression,model_mis_report_kpi_expression,account.group_account_manager,1,1,1,1 access_mis_report_kpi_expression,access_mis_report_kpi_expression,model_mis_report_kpi_expression,base.group_user,1,0,0,0 -manage_mis_report_style,access_mis_report_style,model_mis_report_style,account.group_account_manager,1,0,0,0 +manage_mis_report_style,access_mis_report_style,model_mis_report_style,account.group_account_manager,1,1,1,1 access_mis_report_style,access_mis_report_style,model_mis_report_style,base.group_user,1,0,0,0 diff --git a/mis_builder/security/mis_builder_security.xml b/mis_builder/security/mis_builder_security.xml index d4562df0..e80c51d7 100644 --- a/mis_builder/security/mis_builder_security.xml +++ b/mis_builder/security/mis_builder_security.xml @@ -1,5 +1,5 @@ - + @@ -10,4 +10,4 @@ - + diff --git a/mis_builder/static/src/css/custom.css b/mis_builder/static/src/css/custom.css index f4405a86..2c59d7e7 100644 --- a/mis_builder/static/src/css/custom.css +++ b/mis_builder/static/src/css/custom.css @@ -20,7 +20,7 @@ text-decoration: underline; } -.openerp .oe_mis_builder_buttons { +.odoo .oe_mis_builder_buttons { padding-bottom: 10px; padding-top: 10px; } diff --git a/mis_builder/static/src/xml/mis_widget.xml b/mis_builder/static/src/xml/mis_widget.xml index 8ef0ef04..e077fc5e 100644 --- a/mis_builder/static/src/xml/mis_widget.xml +++ b/mis_builder/static/src/xml/mis_widget.xml @@ -4,10 +4,10 @@

- - - - + + + +
diff --git a/mis_builder/tests/test_accounting_none.py b/mis_builder/tests/test_accounting_none.py index 6a410228..7af50d0b 100644 --- a/mis_builder/tests/test_accounting_none.py +++ b/mis_builder/tests/test_accounting_none.py @@ -4,7 +4,7 @@ import doctest -from openerp.addons.mis_builder.models import accounting_none +from odoo.addons.mis_builder.models import accounting_none def load_tests(loader, tests, ignore): diff --git a/mis_builder/tests/test_aep.py b/mis_builder/tests/test_aep.py index 5b1f349a..a5f4b258 100644 --- a/mis_builder/tests/test_aep.py +++ b/mis_builder/tests/test_aep.py @@ -5,9 +5,9 @@ import datetime import time -from openerp import fields -import openerp.tests.common as common -from openerp.tools.safe_eval import safe_eval +from odoo import fields +import odoo.tests.common as common +from odoo.tools.safe_eval import safe_eval from ..models.aep import AccountingExpressionProcessor as AEP from ..models.accounting_none import AccountingNone diff --git a/mis_builder/tests/test_aggregate.py b/mis_builder/tests/test_aggregate.py index ca92a4d1..2472b2a1 100644 --- a/mis_builder/tests/test_aggregate.py +++ b/mis_builder/tests/test_aggregate.py @@ -4,7 +4,7 @@ import doctest -from openerp.addons.mis_builder.models import aggregate +from odoo.addons.mis_builder.models import aggregate def load_tests(loader, tests, ignore): diff --git a/mis_builder/tests/test_fetch_query.py b/mis_builder/tests/test_fetch_query.py index f701e735..fb4c8609 100644 --- a/mis_builder/tests/test_fetch_query.py +++ b/mis_builder/tests/test_fetch_query.py @@ -2,16 +2,15 @@ # © 2014-2016 ACSONE SA/NV () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -import openerp.tests.common as common +import odoo.tests.common as common class TestFetchQuery(common.TransactionCase): def test_fetch_query(self): # create a report on account.analytic.line - data = self.registry('mis.report.instance').compute( - self.cr, self.uid, - self.ref('mis_builder.mis_report_instance_test')) + report = self.env.ref('mis_builder.mis_report_instance_test') + data = report.compute() self.maxDiff = None self.assertEquals( {'body': diff --git a/mis_builder/tests/test_mis_report_instance.py b/mis_builder/tests/test_mis_report_instance.py index 052b8601..c417f072 100644 --- a/mis_builder/tests/test_mis_report_instance.py +++ b/mis_builder/tests/test_mis_report_instance.py @@ -2,8 +2,8 @@ # © 2016 ACSONE SA/NV () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -import openerp.tests.common as common -from openerp.tools import test_reports +import odoo.tests.common as common +from odoo.tools import test_reports class TestMisReportInstance(common.TransactionCase): diff --git a/mis_builder/tests/test_mis_safe_eval.py b/mis_builder/tests/test_mis_safe_eval.py index f2cf9b06..524f4f3f 100644 --- a/mis_builder/tests/test_mis_safe_eval.py +++ b/mis_builder/tests/test_mis_safe_eval.py @@ -2,7 +2,7 @@ # © 2016 ACSONE SA/NV () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -import openerp.tests.common as common +import odoo.tests.common as common from ..models.mis_safe_eval import mis_safe_eval, DataError, NameDataError diff --git a/mis_builder/tests/test_render.py b/mis_builder/tests/test_render.py index 4a08a6ab..90537f0f 100644 --- a/mis_builder/tests/test_render.py +++ b/mis_builder/tests/test_render.py @@ -2,7 +2,7 @@ # © 2016 ACSONE SA/NV () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -import openerp.tests.common as common +import odoo.tests.common as common from ..models.accounting_none import AccountingNone from ..models.mis_report_style import ( diff --git a/mis_builder/tests/test_simple_array.py b/mis_builder/tests/test_simple_array.py index ab59eed0..ff622fbd 100644 --- a/mis_builder/tests/test_simple_array.py +++ b/mis_builder/tests/test_simple_array.py @@ -4,7 +4,7 @@ import doctest -from openerp.addons.mis_builder.models import simple_array +from odoo.addons.mis_builder.models import simple_array def load_tests(loader, tests, ignore): diff --git a/mis_builder/tests/test_utc_midnight.py b/mis_builder/tests/test_utc_midnight.py index 4e5d3df2..ca574553 100644 --- a/mis_builder/tests/test_utc_midnight.py +++ b/mis_builder/tests/test_utc_midnight.py @@ -2,7 +2,7 @@ # © 2014-2015 ACSONE SA/NV () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -import openerp.tests.common as common +import odoo.tests.common as common from ..models.mis_report import _utc_midnight diff --git a/mis_builder/views/mis_report.xml b/mis_builder/views/mis_report.xml index 83c69cc2..d752eef7 100644 --- a/mis_builder/views/mis_report.xml +++ b/mis_builder/views/mis_report.xml @@ -1,5 +1,5 @@ - + @@ -169,4 +169,4 @@ - + diff --git a/mis_builder/views/mis_report_instance.xml b/mis_builder/views/mis_report_instance.xml index 1d03095c..b018e0fa 100644 --- a/mis_builder/views/mis_report_instance.xml +++ b/mis_builder/views/mis_report_instance.xml @@ -1,5 +1,5 @@ - +