Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.0] migration #67

Merged
merged 23 commits into from
Feb 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
42beb86
[MIG][11.0] mis_builder
JordiBForgeFlow Nov 17, 2017
3243d67
[MIG] fixes
JordiBForgeFlow Dec 29, 2017
71d69d5
[MIG] simple_array
sbidoul Jan 13, 2018
d2dec64
[MIG] mis_builder_demo
sbidoul Jan 13, 2018
612d9ff
[MIG] remove some useless diffs with v10
sbidoul Dec 30, 2017
a8ea6a0
[MIG] remove remnant of previous experiment
sbidoul Dec 30, 2017
d512263
[MIG][FIX] setup.py
sbidoul Dec 30, 2017
13b1f98
[MIG] bump version in mis_builder_budget and mis_builder_demo
sbidoul Dec 30, 2017
4d263fd
[MIG] restore report and instance views as in v10
sbidoul Dec 31, 2017
0450d5f
[MIG] mis_builder_budget: Migrate to Odoo 11
Jan 5, 2018
6d3e87d
[MIG] python headers (copyright and encoding statement)
sbidoul Jan 5, 2018
67db48d
[MIG] revert super() changes to minimize diff with 10.0
sbidoul Jan 5, 2018
a5e7cbc
[MIG] restore drilldown test as it was in 10
sbidoul Jan 6, 2018
30c734c
[MIG][11.0] mis_builder_demo
sbidoul Jan 6, 2018
b6db016
[MIG] restore KpiData as it was in 10
sbidoul Jan 7, 2018
3ed8d76
[MIG] a clean way to declare test models
sbidoul Jan 7, 2018
752bdaf
[MIG] remove unnecessary dummy field
sbidoul Jan 8, 2018
867c6a0
[MIG] fix drilldown issue
JordiBForgeFlow Jan 8, 2018
525c9f4
[MIG] fix template view
JordiBForgeFlow Jan 8, 2018
fb3654e
[MIG] make myself happy with the widget implementation
sbidoul Jan 13, 2018
43f3ef2
[MIG] fix cron declaration
sbidoul Jan 19, 2018
f029d78
[IMP] color attribute deprecated in views
sbidoul Jan 24, 2018
0237f59
[MIG] better way to declare report assets
sbidoul Jan 24, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ addons:
packages:
- expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow

- pdftk # required in reporting-engine repo

language: python

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
Management Information System reports for Odoo: easily build super fast,
beautiful, custom reports such as P&L, Balance Sheets and more.

**Odoo 11.0 is not supported yet, nothing to see here for now.**

**This is the 11.0 branch. Please note the development of new features occurs mainly on
the 10.0 branch, to be forward-ported to 11.0. Please submit pull requests to the 10.0
branch in priority, unless they are 11.0 specific bugs, or they rely on
Expand Down
1 change: 0 additions & 1 deletion mis_builder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
7 changes: 3 additions & 4 deletions mis_builder/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2017 ACSONE SA/NV (<http://acsone.eu>)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might want to raise year up to 2018 ;)

# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
'name': 'MIS Builder',
'version': '10.0.3.1.1',
'version': '11.0.3.1.1',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by convention should be "11.0.0.0" but I understand if you want to keep internal versions in line :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I do the effort of maintaining feature parity across 9 10 11 so this version number expresses that.

'category': 'Reporting',
'summary': """
Build 'Management Information System' Reports and Dashboards
Expand All @@ -31,9 +30,9 @@
'report/mis_report_instance_xlsx.xml',
],
'qweb': [
'static/src/xml/*.xml'
'static/src/xml/mis_report_widget.xml',
],
'installable': False,
'installable': True,
'application': True,
'license': 'AGPL-3',
}
5 changes: 2 additions & 3 deletions mis_builder/datas/ir_cron.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
<field eval="'mis.report.instance'" name="model"/>
<field eval="'_vacuum_report'" name="function"/>
<field eval="'(24,)'" name="args"/>
<field ref="model_mis_report_instance" name="model_id"/>
<field name="code">model._vacuum_report()</field>
<field name="active" eval="True" />
</record>

Expand Down
1 change: 0 additions & 1 deletion mis_builder/migrations/8.0.2.0.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
1 change: 0 additions & 1 deletion mis_builder/migrations/8.0.2.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/accounting_none.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Thomas Binsfeld
# Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/aep.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/aggregate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/data_error.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2016 Akretion (<http://akretion.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/kpimatrix.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/mis_kpi_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/mis_report.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
16 changes: 9 additions & 7 deletions mis_builder/models/mis_report_instance.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2016 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2014-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

import datetime
Expand Down Expand Up @@ -545,25 +544,28 @@ def preview(self):
@api.multi
def print_pdf(self):
self.ensure_one()
context = dict(self.env.context, active_ids=self.ids)
return {
'name': 'MIS report instance QWEB PDF report',
'model': 'mis.report.instance',
'type': 'ir.actions.report.xml',
'type': 'ir.actions.report',
'report_name': 'mis_builder.report_mis_report_instance',
'report_type': 'qweb-pdf',
'context': self.env.context,
'context': context,
}

@api.multi
def export_xls(self):
self.ensure_one()
context = dict(self.env.context, active_ids=self.ids)
return {
'name': 'MIS report instance XLSX report',
'model': 'mis.report.instance',
'type': 'ir.actions.report.xml',
'report_name': 'mis.report.instance.xlsx',
'type': 'ir.actions.report',
'report_name': 'mis_builder.mis_report_instance_xlsx',
'report_type': 'xlsx',
'context': self.env.context,
'report_file': 'mis_report_instance',
'context': context,
}

@api.multi
Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/mis_report_style.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Therp BV (<http://therp.nl>)
# Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
Expand Down
1 change: 0 additions & 1 deletion mis_builder/models/mis_safe_eval.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
3 changes: 0 additions & 3 deletions mis_builder/models/simple_array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
""" A trivial immutable array that supports basic arithmetic operations.
Expand Down Expand Up @@ -84,8 +83,6 @@
2.0 1.0 Vector((2.0, 1.0))
"""

from __future__ import print_function

import itertools
import operator
import traceback
Expand Down
1 change: 0 additions & 1 deletion mis_builder/report/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand Down
17 changes: 8 additions & 9 deletions mis_builder/report/mis_report_instance_qweb.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

Expand All @@ -10,15 +9,15 @@


class Report(models.Model):
_inherit = "report"
_inherit = "ir.actions.report"

@api.model
def get_pdf(self, docids, report_name, html=None, data=None):
@api.multi
def render_qweb_pdf(self, res_ids=None, data=None):
ctx = self.env.context.copy()
if docids:
report = self._get_report_from_name(report_name)
obj = self.env[report.model].browse(docids)[0]
if res_ids:
obj = self.env[self.model].browse(res_ids)[0]
if hasattr(obj, 'landscape_pdf') and obj.landscape_pdf:
ctx.update({'landscape': True})
return super(Report, self.with_context(ctx)).get_pdf(
docids, report_name, html=html, data=data)
return super(Report, self.with_context(ctx)).render_qweb_pdf(
res_ids, data
)
11 changes: 5 additions & 6 deletions mis_builder/report/mis_report_instance_qweb.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="qweb_pdf_export" model="ir.actions.report.xml">
<record id="qweb_pdf_export" model="ir.actions.report">
<field name="name">MIS report instance QWEB PDF report</field>
<field name="model">mis.report.instance</field>
<field name="type">ir.actions.report.xml</field>
<field name="type">ir.actions.report</field>
<field name="report_name">mis_builder.report_mis_report_instance</field>
<field name="report_type">qweb-pdf</field>
<field name="auto" eval="False"/>
</record>

<template id="assets_report" inherit_id="report.assets_common">
<template id="assets_report" inherit_id="web.report_assets_common">
<xpath expr="." position="inside">
<link href="/mis_builder/static/src/css/report.css" rel="stylesheet"/>
</xpath>
Expand All @@ -23,9 +22,9 @@
-->

<template id="report_mis_report_instance">
<t t-call="report.html_container">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<t t-call="web.internal_layout">
<t t-set="matrix" t-value="o._compute_matrix()"/>
<t t-set="style_obj" t-value="o.env['mis.report.style']"/>
<div class="page">
Expand Down
25 changes: 4 additions & 21 deletions mis_builder/report/mis_report_instance_xlsx.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2017 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from collections import defaultdict
import logging
import numbers

from odoo.report import report_sxw
from odoo import models

from ..models.accounting_none import AccountingNone
from ..models.data_error import DataError

_logger = logging.getLogger(__name__)

try:
from odoo.addons.report_xlsx.report.report_xlsx import ReportXlsx
except ImportError:
_logger.debug("report_xlsx not installed, Excel export non functional")

class ReportXlsx(object):
def __init__(self, *args, **kwargs):
pass


ROW_HEIGHT = 15 # xlsxwriter units
COL_WIDTH = 0.9 # xlsxwriter units
MIN_COL_WIDTH = 10 # characters
MAX_COL_WIDTH = 50 # characters


class MisBuilderXlsx(ReportXlsx):

def __init__(self, name, table, rml=False, parser=False, header=True,
store=False):
super(MisBuilderXlsx, self).__init__(
name, table, rml, parser, header, store)
class MisBuilderXlsx(models.AbstractModel):
_name = 'report.mis_builder.mis_report_instance_xlsx'
_inherit = 'report.report_xlsx.abstract'

def generate_xlsx_report(self, workbook, data, objects):

Expand Down Expand Up @@ -144,7 +131,3 @@ def generate_xlsx_report(self, workbook, data, objects):
min_col_pos = min(col_width.keys())
max_col_pos = max(col_width.keys())
sheet.set_column(min_col_pos, max_col_pos, data_col_width * COL_WIDTH)


MisBuilderXlsx('report.mis.report.instance.xlsx',
'mis.report.instance', parser=report_sxw.rml_parse)
14 changes: 7 additions & 7 deletions mis_builder/report/mis_report_instance_xlsx.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="xls_export" model="ir.actions.report.xml">
<field name="name">MIS report instance XLS report</field>
<field name="model">mis.report.instance</field>
<field name="type">ir.actions.report.xml</field>
<field name="report_name">mis.report.instance.xlsx</field>
<field name="report_type">xlsx</field>
<field name="auto" eval="False"/>
<record id="xls_export" model="ir.actions.report">
<field name="name">MIS report instance XLS report</field>
<field name="model">mis.report.instance</field>
<field name="type">ir.actions.report</field>
<field name="report_name">mis_builder.mis_report_instance_xlsx</field>
<field name="report_type">xlsx</field>
<field name="report_file">mis_report_instance</field>
</record>

</odoo>
Loading