[MERGE] from trunk
bzr revid: chm@openerp.com-20140310163630-xoqbu4y5wr9ptj7h
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import controllers
|
||||
import models
|
||||
import tests
|
||||
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
|
||||
@@ -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):
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
import test_reports
|
||||
@@ -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)
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="reporting_settings_form_inherited" model="ir.ui.view">
|
||||
<field name="name">view_company_form_inherited</field>
|
||||
<field name="inherit_id" ref="base.view_company_form" />
|
||||
<field name="model">res.company</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//group[@string='Footer Configuration']" position="after">
|
||||
<group string="QWeb PDF Configuration">
|
||||
<field name="paperformat_id" />
|
||||
</group>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -2,27 +2,7 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Adding a paperformat field inside the report form view -->
|
||||
<record id="act_report_xml_view_inherit" model="ir.ui.view">
|
||||
<field name="name">act_report_xml_view_inherit</field>
|
||||
<field name="inherit_id" ref="base.act_report_xml_view" />
|
||||
<field name="model">ir.actions.report.xml</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='report_file']" position="after">
|
||||
<field name="paperformat_id"/>
|
||||
<button
|
||||
type="object"
|
||||
class="oe_link"
|
||||
string="Search associated QWeb views"
|
||||
name="associated_view"
|
||||
/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- report.paperformat -->
|
||||
<record id="paperformat_view_tree" model="ir.ui.view">
|
||||
<field name="name">paper_format_view_tree</field>
|
||||
<field name="model">report.paperformat</field>
|
||||
@@ -32,7 +12,6 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="paperformat_view_form" model="ir.ui.view">
|
||||
<field name="name">paper_format_view_form</field>
|
||||
<field name="model">report.paperformat</field>
|
||||
@@ -56,47 +35,77 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="paper_format_action" model="ir.actions.act_window">
|
||||
<field name="name">Paper Format General Configuration</field>
|
||||
<field name="res_model">report.paperformat</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<record id='reports_action' model='ir.actions.act_window'>
|
||||
<field name="name">Reports</field>
|
||||
<field name="res_model">ir.actions.report.xml</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem
|
||||
id="reporting_menuitem"
|
||||
name="Reporting"
|
||||
parent="base.menu_custom"
|
||||
sequence="0"
|
||||
<menuitem
|
||||
id="reporting_menuitem"
|
||||
name="Reports"
|
||||
parent="base.menu_custom"
|
||||
sequence="15"
|
||||
groups="base.group_no_one"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
id="paper_format_menuitem"
|
||||
name="Paper Format"
|
||||
parent="reporting_menuitem"
|
||||
action="paper_format_action"
|
||||
sequence="2"
|
||||
<menuitem
|
||||
id="paper_format_menuitem"
|
||||
name="Paper Format"
|
||||
parent="reporting_menuitem"
|
||||
action="paper_format_action"
|
||||
sequence="2"
|
||||
groups="base.group_no_one"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
<menuitem
|
||||
id="reports_menuitem"
|
||||
name="Reports"
|
||||
parent="reporting_menuitem"
|
||||
parent="reporting_menuitem"
|
||||
action="reports_action"
|
||||
sequence="3"
|
||||
groups="base.group_no_one"
|
||||
/>
|
||||
|
||||
<!-- Add a paperformat and web button to the report form view -->
|
||||
<record id="act_report_xml_view_inherit" model="ir.ui.view">
|
||||
<field name="name">act_report_xml_view_inherit</field>
|
||||
<field name="inherit_id" ref="base.act_report_xml_view" />
|
||||
<field name="model">ir.actions.report.xml</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='attachment']" position="after">
|
||||
<field name="paperformat_id" attrs="{'invisible':[('report_type','not in',['qweb-pdf'])]}"/>
|
||||
<button
|
||||
type="object"
|
||||
class="oe_link"
|
||||
string="Search associated QWeb views"
|
||||
name="associated_view"
|
||||
/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Adding a paperformat field inside to the company form view -->
|
||||
<record id="reporting_settings_form_inherited" model="ir.ui.view">
|
||||
<field name="name">view_company_form_inherited</field>
|
||||
<field name="inherit_id" ref="base.view_company_form" />
|
||||
<field name="model">res.company</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//group[@string='Footer Configuration']" position="after">
|
||||
<group string="QWeb PDF Configuration">
|
||||
<field name="paperformat_id" />
|
||||
</group>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user