diff --git a/addons/account/i18n/zh_CN.po b/addons/account/i18n/zh_CN.po
index 227aae3822c..583f78d2490 100644
--- a/addons/account/i18n/zh_CN.po
+++ b/addons/account/i18n/zh_CN.po
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-03-06 05:43+0000\n"
+"X-Launchpad-Export-Date: 2014-03-07 06:39+0000\n"
"X-Generator: Launchpad (build 16948)\n"
#. module: account
@@ -436,7 +436,7 @@ msgid ""
msgstr ""
"此处可以管理属于公司或者个人的资产.\n"
" 跟踪资产折旧的发生,创建折旧明细账户。.\n"
-" 要安装account_asset模块. 如果不检查box, 可以处理传票和付款,\n"
+" 要安装account_asset模块. 如果不检查box, 可以处理发票和付款,\n"
" 但不能处理账记(分录明细, 科目表, ...)"
#. module: account
@@ -7732,7 +7732,7 @@ msgstr "发票明细"
#. module: account
#: view:account.invoice.report:0
msgid "Customer And Supplier Refunds"
-msgstr "客户和供应商红字传票"
+msgstr "客户和供应商红字发票"
#. module: account
#: field:account.financial.report,sign:0
diff --git a/addons/report/__init__.py b/addons/report/__init__.py
index d08c9d29951..12d9fe89642 100644
--- a/addons/report/__init__.py
+++ b/addons/report/__init__.py
@@ -1,3 +1,4 @@
import controllers
import models
+import tests
diff --git a/addons/report/__openerp__.py b/addons/report/__openerp__.py
index 8ce4e46991c..c07cdc44403 100644
--- a/addons/report/__openerp__.py
+++ b/addons/report/__openerp__.py
@@ -10,8 +10,7 @@ Report
'depends': ['base'],
'data': [
'views/layouts.xml',
- 'views/paperformat_view.xml',
- 'views/res_company_view.xml',
+ 'views/views.xml',
'data/report_paperformat.xml',
'security/ir.model.access.csv',
],
diff --git a/addons/report/controllers/main.py b/addons/report/controllers/main.py
index f71d4ea7d8b..1a839fc2c1f 100644
--- a/addons/report/controllers/main.py
+++ b/addons/report/controllers/main.py
@@ -42,7 +42,6 @@ import os
from distutils.version import LooseVersion
-from pyPdf import PdfFileWriter, PdfFileReader
from werkzeug import exceptions
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
@@ -51,7 +50,10 @@ from reportlab.graphics.barcode import createBarcodeDrawing
_logger = logging.getLogger(__name__)
-
+try:
+ from pyPdf import PdfFileWriter, PdfFileReader
+except ImportError:
+ PdfFileWriter = PdfFileReader = None
class Report(http.Controller):
diff --git a/addons/report/tests/__init__.py b/addons/report/tests/__init__.py
new file mode 100644
index 00000000000..fc192463ec6
--- /dev/null
+++ b/addons/report/tests/__init__.py
@@ -0,0 +1 @@
+import test_reports
diff --git a/addons/report/tests/test_reports.py b/addons/report/tests/test_reports.py
new file mode 100644
index 00000000000..361e0a7aa0f
--- /dev/null
+++ b/addons/report/tests/test_reports.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+import logging
+
+import openerp
+import urllib2
+
+_logger = logging.getLogger(__name__)
+
+class TestReports(openerp.tests.HttpCase):
+ def test_reports(self):
+ registry, cr, uid = self.registry, self.cr, self.uid
+ r_model = registry('ir.actions.report.xml')
+ domain = [('report_type','like','qweb')]
+ for r in r_model.browse(cr, uid, r_model.search(cr, uid, domain)):
+ report_model = registry(r.model)
+ report_model_ids = report_model.search(cr, uid, [], limit=10)
+ if not report_model_ids:
+ _logger.info("no record found skipping report %s", r.report_name)
+ continue
+ if not r.multi:
+ report_model_ids = report_model_ids[:1]
+ url = "/report/%s/%s" % (r.report_name, ','.join(str(i) for i in report_model_ids))
+ _logger.info("testing report %s", url)
+ # TODO sle: uncomment this
+ #content = self.url_open(url)
+
diff --git a/addons/report/views/res_company_view.xml b/addons/report/views/res_company_view.xml
deleted file mode 100644
index 97abd9f5cae..00000000000
--- a/addons/report/views/res_company_view.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
- view_company_form_inherited
-
- res.company
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/addons/report/views/paperformat_view.xml b/addons/report/views/views.xml
similarity index 68%
rename from addons/report/views/paperformat_view.xml
rename to addons/report/views/views.xml
index c885261416b..c5d07f5287b 100644
--- a/addons/report/views/paperformat_view.xml
+++ b/addons/report/views/views.xml
@@ -2,27 +2,7 @@
-
-
- act_report_xml_view_inherit
-
- ir.actions.report.xml
-
-
-
-
-
-
-
-
-
-
-
+
paper_format_view_tree
report.paperformat
@@ -32,7 +12,6 @@
-
paper_format_view_form
report.paperformat
@@ -56,47 +35,77 @@
-
-
Paper Format General Configuration
report.paperformat
form
tree,form
-
Reports
ir.actions.report.xml
form
tree,form
-
-
-
-
-
-
-
+
+
+
+ act_report_xml_view_inherit
+
+ ir.actions.report.xml
+
+
+
+
+
+
+
+
+
+
+
+
+ view_company_form_inherited
+
+ res.company
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py
index 46b9efc15a8..f73138313ab 100644
--- a/addons/website/models/ir_http.py
+++ b/addons/website/models/ir_http.py
@@ -78,21 +78,18 @@ class ir_http(orm.AbstractModel):
return self._dispatch()
- def _postprocess_args(self, arguments):
- url = request.httprequest.url
- for arg in arguments.itervalues():
- if isinstance(arg, orm.browse_record) and isinstance(arg._uid, RequestUID):
- placeholder = arg._uid
- arg._uid = request.uid
- try:
- good_slug = slug(arg)
- if str(arg.id) != placeholder.value and placeholder.value != good_slug:
- # TODO: properly recompose the url instead of using replace()
- url = url.replace(placeholder.value, good_slug)
- except KeyError:
- return self._handle_exception(werkzeug.exceptions.NotFound())
- if url != request.httprequest.url:
- werkzeug.exceptions.abort(werkzeug.utils.redirect(url))
+ def _postprocess_args(self, arguments, rule):
+ for arg, val in arguments.items():
+ # Replace uid placeholder by the current request.uid
+ if isinstance(val, orm.browse_record) and isinstance(val._uid, RequestUID):
+ val._uid = request.uid
+ try:
+ _, path = rule.build(arguments)
+ assert path is not None
+ except Exception:
+ return self._handle_exception(werkzeug.exceptions.NotFound())
+ if path != request.httprequest.path:
+ return werkzeug.utils.redirect(path)
def _handle_exception(self, exception=None, code=500):
if isinstance(exception, werkzeug.exceptions.HTTPException) and hasattr(exception, 'response') and exception.response: