Browse Source

Migration of mis_builder to 10.0

pull/239/head
Adrien Peiffer (ACSONE) 8 years ago
committed by Stéphane Bidoul (ACSONE)
parent
commit
f34b7cfae2
  1. 5
      mis_builder/__manifest__.py
  2. 4
      mis_builder/datas/ir_cron.xml
  3. 8
      mis_builder/models/aep.py
  4. 9
      mis_builder/models/mis_report.py
  5. 6
      mis_builder/models/mis_report_instance.py
  6. 4
      mis_builder/models/mis_report_style.py
  7. 2
      mis_builder/models/mis_safe_eval.py
  8. 23
      mis_builder/report/mis_report_instance_qweb.py
  9. 4
      mis_builder/report/mis_report_instance_qweb.xml
  10. 4
      mis_builder/report/mis_report_instance_xlsx.py
  11. 4
      mis_builder/report/mis_report_instance_xlsx.xml
  12. 4
      mis_builder/security/mis_builder_security.xml
  13. 2
      mis_builder/static/src/css/custom.css
  14. 8
      mis_builder/static/src/xml/mis_widget.xml
  15. 2
      mis_builder/tests/test_accounting_none.py
  16. 6
      mis_builder/tests/test_aep.py
  17. 2
      mis_builder/tests/test_aggregate.py
  18. 2
      mis_builder/tests/test_fetch_query.py
  19. 4
      mis_builder/tests/test_mis_report_instance.py
  20. 2
      mis_builder/tests/test_mis_safe_eval.py
  21. 2
      mis_builder/tests/test_render.py
  22. 2
      mis_builder/tests/test_simple_array.py
  23. 2
      mis_builder/tests/test_utc_midnight.py
  24. 4
      mis_builder/views/mis_report.xml
  25. 20
      mis_builder/views/mis_report_instance.xml
  26. 4
      mis_builder/views/mis_report_style.xml
  27. 2
      mis_builder/wizard/mis_builder_dashboard.py
  28. 4
      mis_builder/wizard/mis_builder_dashboard.xml

5
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,6 +14,7 @@
'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
@ -40,7 +41,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

9
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

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>

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

2
mis_builder/tests/test_fetch_query.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).
import openerp.tests.common as common
import odoo.tests.common as common
class TestFetchQuery(common.TransactionCase):

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>
Loading…
Cancel
Save