Browse Source

Merge pull request #26 from dreispt/7.0-fix-travis

7.0 Fix TravisCI tests
pull/43/head
Alexandre Fayolle 9 years ago
parent
commit
008f6780b1
  1. 43
      .travis.yml
  2. 1
      base_report_assembler/__init__.py
  3. 4
      base_report_assembler/assembled_report.py
  4. 11
      base_report_assembler/ir_report.py
  5. 18
      base_report_assembler/report_assembler.py
  6. 15
      oca_dependencies.txt
  7. 12
      report_custom_filename/__openerp__.py
  8. 3
      report_custom_filename/controllers/reports.py
  9. 4
      report_xls/report_xls.py

43
.travis.yml

@ -0,0 +1,43 @@
language: python
sudo: false
cache: pip
python:
- "2.7"
addons:
apt:
packages:
- expect-dev # provides unbuffer utility
- python-lxml # because pip installation is slow
- python-simplejson
- python-serial
- python-yaml
- python-pypdf # repo specific
env:
global:
- VERSION="7.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0"
- TRANSIFEX_USER='transbot@odoo-community.org'
- secure:NUsXwVrMntcqge1ozKW+DSkP7dq+Rla6JVvFF2c89/g+zJaIqQRi8EQBLoqNwCdMk+rjpQeZt/JPELjH+EzPcmGddhDxOgVB3nUT9LvFXGCHF+NjmHXqyba4tuc7BnpG1WDD+rSlxVCt1aIjNIhhaZ4ic0rCWpKNYu/yFTsmChc=
matrix:
- LINT_CHECK="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"
- TRANSIFEX="1"
virtualenv:
system_site_packages: true
install:
- pip install PyPDF2 fdfgen
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly
script:
- travis_run_tests
after_success:
- travis_after_tests_success

1
base_report_assembler/__init__.py

@ -21,4 +21,3 @@
from . import report_assembler from . import report_assembler
from . import assembled_report from . import assembled_report
from . import ir_report from . import ir_report

4
base_report_assembler/assembled_report.py

@ -20,6 +20,7 @@
############################################################################## ##############################################################################
from openerp.osv import orm, fields from openerp.osv import orm, fields
class AssembledReport(orm.Model): class AssembledReport(orm.Model):
_name = 'assembled.report' _name = 'assembled.report'
@ -37,6 +38,7 @@ class AssembledReport(orm.Model):
_defaults = { _defaults = {
'sequence': 1, 'sequence': 1,
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(
'company_id': lambda s, cr, uid, c: s.pool.get(
'res.company')._company_default_get(
cr, uid, 'assembled.report', context=c) cr, uid, 'assembled.report', context=c)
} }

11
base_report_assembler/ir_report.py

@ -21,7 +21,7 @@
from openerp.osv import orm from openerp.osv import orm
from openerp import netsvc from openerp import netsvc
from openerp.report.report_sxw import rml_parse from openerp.report.report_sxw import rml_parse
from report_assembler import PDFReportAssembler
from .report_assembler import PDFReportAssembler
def register_report(name, model, parser=rml_parse): def register_report(name, model, parser=rml_parse):
@ -48,7 +48,8 @@ class ReportAssembleXML(orm.Model):
def register_all(self, cursor): def register_all(self, cursor):
value = super(ReportAssembleXML, self).register_all(cursor) value = super(ReportAssembleXML, self).register_all(cursor)
cursor.execute("SELECT * FROM ir_act_report_xml WHERE report_type = 'assemblage'")
cursor.execute(
"SELECT * FROM ir_act_report_xml WHERE report_type = 'assemblage'")
records = cursor.dictfetchall() records = cursor.dictfetchall()
for record in records: for record in records:
register_report(record['report_name'], record['model']) register_report(record['report_name'], record['model'])
@ -77,7 +78,8 @@ class ReportAssembleXML(orm.Model):
def create(self, cursor, user, vals, context=None): def create(self, cursor, user, vals, context=None):
""" Create report and register it """ """ Create report and register it """
res = super(ReportAssembleXML, self).create(cursor, user, vals, context)
res = super(ReportAssembleXML, self).create(
cursor, user, vals, context)
if vals.get('report_type', '') == 'assemblage': if vals.get('report_type', '') == 'assemblage':
# I really look forward to virtual functions :S # I really look forward to virtual functions :S
register_report( register_report(
@ -105,6 +107,3 @@ class ReportAssembleXML(orm.Model):
) )
res = super(ReportAssembleXML, self).write(cr, uid, ids, vals, context) res = super(ReportAssembleXML, self).write(cr, uid, ids, vals, context)
return res return res
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

18
base_report_assembler/report_assembler.py

@ -93,7 +93,8 @@ class PDFReportAssembler(report_sxw.report_sxw):
report_ids = self._get_report_ids(cr, uid, ids, context=context) report_ids = self._get_report_ids(cr, uid, ids, context=context)
pdf_reports = self._generate_all_pdf(cr, uid, ids, data, report_ids, context=context)
pdf_reports = self._generate_all_pdf(
cr, uid, ids, data, report_ids, context=context)
pdf_assemblage = assemble_pdf(pdf_reports) pdf_assemblage = assemble_pdf(pdf_reports)
return pdf_assemblage, 'pdf' return pdf_assemblage, 'pdf'
@ -103,8 +104,10 @@ class PDFReportAssembler(report_sxw.report_sxw):
Code taken from report openoffice. Thanks guys :) """ Code taken from report openoffice. Thanks guys :) """
pool = pooler.get_pool(cr.dbname) pool = pooler.get_pool(cr.dbname)
ir_obj = pool.get('ir.actions.report.xml') ir_obj = pool.get('ir.actions.report.xml')
report_xml_ids = ir_obj.search(cr, uid,
[('report_name', '=', self.name[7:])], context=context)
report_xml_ids = ir_obj.search(
cr, uid,
[('report_name', '=', self.name[7:])],
context=context)
if report_xml_ids: if report_xml_ids:
report_xml = ir_obj.browse(cr, report_xml = ir_obj.browse(cr,
@ -117,10 +120,13 @@ class PDFReportAssembler(report_sxw.report_sxw):
report_xml.report_sxw_content = None report_xml.report_sxw_content = None
report_xml.report_sxw = None report_xml.report_sxw = None
else: else:
return super(PDFReportAssembler, self).create(cr, uid, ids, data, context)
return super(PDFReportAssembler, self).create(
cr, uid, ids, data, context)
if report_xml.report_type != 'assemblage': if report_xml.report_type != 'assemblage':
return super(PDFReportAssembler, self).create(cr, uid, ids, data, context)
result = self.create_source_pdf(cr, uid, ids, data, report_xml, context)
return super(PDFReportAssembler, self).create(
cr, uid, ids, data, context)
result = self.create_source_pdf(
cr, uid, ids, data, report_xml, context)
if not result: if not result:
return (False, False) return (False, False)
return result return result

15
oca_dependencies.txt

@ -0,0 +1,15 @@
# List the OCA project dependencies, one per line
# Add a repository url and branch if you need a forked version
#
# Examples
# ========
#
# To depend on the standard version of sale-workflow, use:
# sale-workflow
#
# To explicitely give the URL of a fork, and still use the version specified in
# .travis.yml, use:
# sale-workflow https://github.com/OCA/sale-workflow
#
# To provide both the URL and a branch, use:
# sale-workflow https://github.com/OCA/sale-workflow branchname

12
report_custom_filename/__openerp__.py

@ -35,12 +35,16 @@ This addon allows for custom filenames for reports.
Configuration Configuration
============= =============
To configure this module, open the report whose filename you want to change and fill in the `Download filename` field. This field is evaluated as jinja2 template with `objects` being a list of browse records of the records to print, and `o` the first record.
To configure this module, open the report whose filename you want to change
and fill in the `Download filename` field. This field is evaluated as jinja2
template with `objects` being a list of browse records of the records to
print, and `o` the first record.
Known issues / Roadmap Known issues / Roadmap
====================== ======================
* Currently, only old-style reports (ir.actions.report.xml) are supported, it should be simple to add support for qweb reports.
* Currently, only old-style reports (ir.actions.report.xml) are supported,
it should be simple to add support for qweb reports.
Credits Credits
======= =======
@ -65,7 +69,9 @@ Maintainer
This module is maintained by the OCA. This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit http://odoo-community.org. To contribute to this module, please visit http://odoo-community.org.
""", """,

3
report_custom_filename/controllers/reports.py

@ -36,7 +36,8 @@ class Reports(main.Reports):
report_ids = report_xml.search( report_ids = report_xml.search(
[('report_name', '=', action['report_name'])], [('report_name', '=', action['report_name'])],
0, False, False, context) 0, False, False, context)
for report in report_xml.read(report_ids, fields=['download_filename']):
for report in report_xml.read(report_ids,
fields=['download_filename']):
if not report.get('download_filename'): if not report.get('download_filename'):
continue continue
objects = req.session.model(context['active_model'])\ objects = req.session.model(context['active_model'])\

4
report_xls/report_xls.py

@ -30,7 +30,6 @@ import inspect
from types import CodeType from types import CodeType
from openerp.report.report_sxw import report_sxw from openerp.report.report_sxw import report_sxw
from openerp import pooler from openerp import pooler
from openerp.tools.translate import translate, _
import logging import logging
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@ -77,8 +76,7 @@ class report_xls(report_sxw):
'fill': 'pattern: pattern solid, fore_color %s;' % _pfc, 'fill': 'pattern: pattern solid, fore_color %s;' % _pfc,
'fill_blue': 'pattern: pattern solid, fore_color 27;', 'fill_blue': 'pattern: pattern solid, fore_color 27;',
'fill_grey': 'pattern: pattern solid, fore_color 22;', 'fill_grey': 'pattern: pattern solid, fore_color 22;',
'borders_all':
'borders: '
'borders_all': 'borders: '
'left thin, right thin, top thin, bottom thin, ' 'left thin, right thin, top thin, bottom thin, '
'left_colour %s, right_colour %s, ' 'left_colour %s, right_colour %s, '
'top_colour %s, bottom_colour %s;' 'top_colour %s, bottom_colour %s;'

Loading…
Cancel
Save