Skip to content

Commit

Permalink
Fix linter warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
yajo committed Jul 25, 2016
1 parent 2bf93a1 commit b02cc1c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 71 deletions.
3 changes: 1 addition & 2 deletions report_xls/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
Expand All @@ -22,4 +22,3 @@

from . import ir_report
from . import report_xls
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
52 changes: 1 addition & 51 deletions report_xls/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
Expand Down Expand Up @@ -26,57 +26,7 @@
'author': "Noviat,Odoo Community Association (OCA)",
'website': 'http://www.noviat.com',
'category': 'Reporting',
'description': """
Excel report engine
===================
This module adds Excel export capabilities to the standard odoo reporting
engine.
Report development
''''''''''''''''''
In order to create an Excel report you can\n
- define a report of type 'xls'
- pass ``{'xls_export': 1}`` via the context to the report create method
The ``report_xls`` class contains a number of attributes and methods to
facilitate the creation XLS reports in OpenERP.
* cell types
Supported cell types : text, number, boolean, date.
* cell styles
The predefined cell style definitions result in a consistent
look and feel of the OpenERP Excel reports.
* cell formulas
Cell formulas can be easily added with the help of the ``rowcol_to_cell()``
function which you can import from the ``utils.py`` module.
* Excel templates
It is possible to define Excel templates which can be adapted
by 'inherited' modules.
Download the ``account_move_line_report_xls`` module
from http://apps.odoo.com as example.
* XLS with multiple sheets
Download the ``account_journal_report_xls`` module
from http://apps.odoo.com as example.
Development assistance
''''''''''''''''''''''
Contact [email protected] for help with the development of
Excel reports in odoo.
""",

This comment has been minimized.

Copy link
@gurneyalex

gurneyalex Aug 9, 2016

Member

this change broke the Runbot builds of all repositories depending on report_xls, as it triggers a warning for the lack of description / README.rst file 😿

This comment has been minimized.

Copy link
@pedrobaeza

pedrobaeza Aug 9, 2016

Member

Fixed in fddca41

'depends': ['base'],
'external_dependencies': {'python': ['xlwt']},
'active': False,
'installable': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
10 changes: 4 additions & 6 deletions report_xls/ir_report.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
Expand All @@ -20,17 +20,15 @@
#
##############################################################################

from openerp.osv import orm
from openerp import models


class ir_actions_report_xml(orm.Model):
class IrActionsReportXml(models.Model):
_inherit = 'ir.actions.report.xml'

def _check_selection_field_value(self, cr, uid,
field, value, context=None):
if field == 'report_type' and value == 'xls':
return
return super(ir_actions_report_xml, self)._check_selection_field_value(
return super(IrActionsReportXml, self)._check_selection_field_value(
cr, uid, field, value, context=context)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
17 changes: 8 additions & 9 deletions report_xls/report_xls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
Expand Down Expand Up @@ -44,7 +44,7 @@ def __init__(self, *args, **kwargs):
self.__dict__ = self


class report_xls(report_sxw):
class ReportXls(report_sxw):

xls_types = {
'bool': xlwt.Row.set_cell_boolean,
Expand Down Expand Up @@ -112,7 +112,7 @@ def create(self, cr, uid, ids, data, context=None):
# use model from 'data' when no ir.actions.report.xml entry
self.table = data.get('model') or self.table
return self.create_source_xls(cr, uid, ids, data, context)
return super(report_xls, self).create(cr, uid, ids, data, context)
return super(ReportXls, self).create(cr, uid, ids, data, context)

def create_source_xls(self, cr, uid, ids, data, context=None):
if not context:
Expand Down Expand Up @@ -166,7 +166,8 @@ def render(self, wanted, col_specs, rowtype, render_space='empty'):
row = col_specs[wanted][rowtype][:]
for i in range(len(row)):
if isinstance(row[i], CodeType):
row[i] = eval(row[i], render_space)
# TODO Use safe_eval or document why not and remove pylint hack
row[i] = eval(row[i], render_space) # pylint: disable=W0123
row.insert(0, wanted)
return row

Expand Down Expand Up @@ -205,7 +206,7 @@ def xls_row_template(self, specs, wanted_list):
c.append({'formula': s[5]})
else:
c.append({
'write_cell_func': report_xls.xls_types[c[3]]})
'write_cell_func': ReportXls.xls_types[c[3]]})
# Set custom cell style
if s_len > 6 and s[6] is not None:
c.append(s[6])
Expand All @@ -220,7 +221,7 @@ def xls_row_template(self, specs, wanted_list):
col += c[1]
break
if not found:
_logger.warn("report_xls.xls_row_template, "
_logger.warn("ReportXls.xls_row_template, "
"column '%s' not found in specs", w)
return r

Expand All @@ -234,7 +235,7 @@ def xls_write_row(self, ws, row_pos, row_data,
style = spec[6] and spec[6] or row_style
if not data:
# if no data, use default values
data = report_xls.xls_types_default[spec[3]]
data = ReportXls.xls_types_default[spec[3]]
if size != 1:
if formula:
ws.write_merge(
Expand All @@ -250,5 +251,3 @@ def xls_write_row(self, ws, row_pos, row_data,
if set_column_size:
ws.col(col).width = spec[2] * 256
return row_pos + 1

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4 changes: 1 addition & 3 deletions report_xls/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
Expand Down Expand Up @@ -47,5 +47,3 @@ def rowcol_to_cell(row, col, row_abs=False, col_abs=False):
chr2 = chr(ord('A') + m)
# Zero index to 1-index
return col_abs + chr1 + chr2 + row_abs + str(row + 1)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

1 comment on commit b02cc1c

@pedrobaeza
Copy link
Member

Choose a reason for hiding this comment

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

Uhm, it seems to be a forgotten git add --all command. I'll fix it.

Please sign in to comment.