Browse Source

Merge pull request #239 from acsone/10-mig-mis-builder-ape

Migration of mis_builder to 10.0
pull/264/head
Alexis de Lattre 8 years ago
committed by GitHub
parent
commit
f8ff3ed649
  1. 8
      mis_builder/CHANGES.rst
  2. 6
      mis_builder/README.rst
  3. 8
      mis_builder/__manifest__.py
  4. 4
      mis_builder/datas/ir_cron.xml
  5. 8
      mis_builder/models/aep.py
  6. 23
      mis_builder/models/mis_report.py
  7. 6
      mis_builder/models/mis_report_instance.py
  8. 4
      mis_builder/models/mis_report_style.py
  9. 2
      mis_builder/models/mis_safe_eval.py
  10. 23
      mis_builder/report/mis_report_instance_qweb.py
  11. 4
      mis_builder/report/mis_report_instance_qweb.xml
  12. 4
      mis_builder/report/mis_report_instance_xlsx.py
  13. 4
      mis_builder/report/mis_report_instance_xlsx.xml
  14. 2
      mis_builder/security/ir.model.access.csv
  15. 4
      mis_builder/security/mis_builder_security.xml
  16. 2
      mis_builder/static/src/css/custom.css
  17. 8
      mis_builder/static/src/xml/mis_widget.xml
  18. 2
      mis_builder/tests/test_accounting_none.py
  19. 6
      mis_builder/tests/test_aep.py
  20. 2
      mis_builder/tests/test_aggregate.py
  21. 7
      mis_builder/tests/test_fetch_query.py
  22. 4
      mis_builder/tests/test_mis_report_instance.py
  23. 2
      mis_builder/tests/test_mis_safe_eval.py
  24. 2
      mis_builder/tests/test_render.py
  25. 2
      mis_builder/tests/test_simple_array.py
  26. 2
      mis_builder/tests/test_utc_midnight.py
  27. 4
      mis_builder/views/mis_report.xml
  28. 20
      mis_builder/views/mis_report_instance.xml
  29. 4
      mis_builder/views/mis_report_style.xml
  30. 2
      mis_builder/wizard/mis_builder_dashboard.py
  31. 4
      mis_builder/wizard/mis_builder_dashboard.xml
  32. 1
      setup/mis_builder/odoo/__init__.py
  33. 1
      setup/mis_builder/odoo/addons/__init__.py
  34. 1
      setup/mis_builder/odoo/addons/mis_builder
  35. 6
      setup/mis_builder/setup.py

8
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)
~~~~~~~~~~~~~~~~~~~~~~

6
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
===============

8
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',
}

4
mis_builder/datas/ir_cron.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<odoo>
<data noupdate="1">
<record id="ir_cron_vacuum_temp_reports" model="ir.cron">
@ -15,4 +15,4 @@
</record>
</data>
</openerp>
</odoo>

8
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

23
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,

6
mis_builder/models/mis_report_instance.py

@ -2,7 +2,7 @@
# © 2014-2016 ACSONE SA/NV (<http://acsone.eu>)
# 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)

4
mis_builder/models/mis_report_style.py

@ -3,8 +3,8 @@
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
# 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

2
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

23
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)

4
mis_builder/report/mis_report_instance_qweb.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<odoo>
<data>
<record id="qweb_pdf_export" model="ir.actions.report.xml">
@ -86,4 +86,4 @@
</template>
</data>
</openerp>
</odoo>

4
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")

4
mis_builder/report/mis_report_instance_xlsx.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<odoo>
<data>
<record id="xls_export" model="ir.actions.report.xml">
@ -12,4 +12,4 @@
</record>
</data>
</openerp>
</odoo>

2
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

4
mis_builder/security/mis_builder_security.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<odoo>
<data noupdate="0">
<record id="mis_builder_multi_company_rule" model="ir.rule">
@ -10,4 +10,4 @@
</record>
</data>
</openerp>
</odoo>

2
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;
}

8
mis_builder/static/src/xml/mis_widget.xml

@ -4,10 +4,10 @@
<t t-if="widget.mis_report_data">
<h2><t t-esc="widget.mis_report_data.report_name" /></h2>
<div class="oe_mis_builder_buttons oe_right oe_button_box">
<button class="oe_mis_builder_generate_content btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-refresh.png"/> Refresh</button>
<button class="oe_mis_builder_print btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-print.png"/> Print</button>
<button class="oe_mis_builder_export btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-go-down.png"/>Export</button>
<button style="display: none;" class="oe_mis_builder_settings btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-execute.png"/> Settings</button>
<button class="oe_mis_builder_generate_content btn btn-sm oe_button"><span class="fa fa-refresh"/> Refresh</button>
<button class="oe_mis_builder_print btn btn-sm oe_button"><span class="fa fa-print"/> Print</button>
<button class="oe_mis_builder_export btn btn-sm oe_button"><span class="fa fa-download"/>Export</button>
<button style="display: none;" class="oe_mis_builder_settings btn btn-sm oe_button"><span class="fa fa-cog"/> Settings</button>
</div>
<table class="oe_list_content o_list_view table table-condensed table-striped mis_builder">
<thead>

2
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):

6
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

2
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):

7
mis_builder/tests/test_fetch_query.py

@ -2,16 +2,15 @@
# © 2014-2016 ACSONE SA/NV (<http://acsone.eu>)
# 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':

4
mis_builder/tests/test_mis_report_instance.py

@ -2,8 +2,8 @@
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
# 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):

2
mis_builder/tests/test_mis_safe_eval.py

@ -2,7 +2,7 @@
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
# 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

2
mis_builder/tests/test_render.py

@ -2,7 +2,7 @@
# © 2016 ACSONE SA/NV (<http://acsone.eu>)
# 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 (

2
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):

2
mis_builder/tests/test_utc_midnight.py

@ -2,7 +2,7 @@
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
# 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

4
mis_builder/views/mis_report.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<odoo>
<data>
<record model="ir.ui.view" id="mis_report_view_tree">
@ -169,4 +169,4 @@
<menuitem id="mis_report_view_menu" parent="mis_report_conf_menu" name="MIS Report Templates" action="mis_report_view_action" sequence="21"/>
</data>
</openerp>
</odoo>

20
mis_builder/views/mis_report_instance.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<odoo>
<data>
<template id="assets_backend" name="mis_builder" inherit_id="web.assets_backend">
@ -25,9 +25,9 @@
<field name="model">mis.report.instance</field>
<field name="arch" type="xml">
<tree string="MIS Report Instances">
<button name="preview" type="object" icon="gtk-print-preview" />
<button type="object" name="print_pdf" string="Print" icon="gtk-print" />
<button type="object" name="export_xls" string="Export" icon="gtk-go-down" />
<button name="preview" type="object" icon="fa-search" />
<button type="object" name="print_pdf" string="Print" icon="fa-print" />
<button type="object" name="export_xls" string="Export" icon="fa-download" />
<field name="name"/>
<field name="report_id" string="Template"/>
<field name="company_id" groups="base.group_multi_company"/>
@ -46,11 +46,11 @@
<sheet>
<field name="temporary" invisible="1"/>
<div class="oe_read_only oe_right oe_button_box" name="buttons">
<button type="object" name="preview" string="Preview" icon="gtk-print-preview" />
<button type="object" name="print_pdf" string="Print" icon="gtk-print" />
<button type="object" name="export_xls" string="Export" icon="gtk-go-down" />
<button type="action" name="%(mis_report_instance_add_to_dashboard_action)d" string="Add to dashboard" icon="gtk-add" attrs="{'invisible': [('temporary', '=', True)]}"/>
<button type="object" name="save_report" string="Save" icon="gtk-floppy" attrs="{'invisible': [('temporary', '=', False)]}"/>
<button type="object" name="preview" string="Preview" icon="fa-search" />
<button type="object" name="print_pdf" string="Print" icon="fa-print" />
<button type="object" name="export_xls" string="Export" icon="fa-download" />
<button type="action" name="%(mis_report_instance_add_to_dashboard_action)d" string="Add to dashboard" icon="fa-plus" attrs="{'invisible': [('temporary', '=', True)]}"/>
<button type="object" name="save_report" string="Save" icon="fa-save" attrs="{'invisible': [('temporary', '=', False)]}"/>
</div>
<div class="oe_title">
<div class="oe_edit_only">
@ -202,4 +202,4 @@
</record>
</data>
</openerp>
</odoo>

4
mis_builder/views/mis_report_style.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<odoo>
<data>
<record model="ir.ui.view" id="mis_report_style_view_tree">
@ -77,4 +77,4 @@
<menuitem id="mis_report_style_view_menu" parent="mis_report_conf_menu" name="MIS Report Styles" action="mis_report_style_view_action" sequence="22"/>
</data>
</openerp>
</odoo>

2
mis_builder/wizard/mis_builder_dashboard.py

@ -2,7 +2,7 @@
# © 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
# 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
from lxml import etree

4
mis_builder/wizard/mis_builder_dashboard.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<odoo>
<data>
<record model="ir.ui.view" id="mis_report_instance_add_to_dashboard_form_view">
@ -30,4 +30,4 @@
</record>
</data>
</openerp>
</odoo>

1
setup/mis_builder/odoo/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/mis_builder/odoo/addons/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/mis_builder/odoo/addons/mis_builder

@ -0,0 +1 @@
../../../../mis_builder

6
setup/mis_builder/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save