- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我花了 5 个多小时在谷歌中搜索关于在 odoo 9.0 中创建报告但仍然一无所获,我想制作看起来像 TreeView 的报告,在 pdf 中,使用 Qweb,我发现的一切都是发票,但我没有'知道如何在我的示例中进行报告。
例如,假设我在 odoo 插件“示例”中有文件夹,其中包含模型(example.py、init.py)和 View (example_view.xml)文件夹和init.py,openerp.py,你知道最简单的模块,我的问题是:告诉我我必须添加什么以及在哪里,我必须将什么写入 XML 以制作一个简单的报告看起来像 TreeView (这个 View 在 View 文件夹中),仅此而已。
我是一个学习例子的人,我需要例子来理解一些东西。
感谢回答:)
最佳答案
要创建一个简单的报告,请执行以下操作。
定义报表xml文件
/addons/example/views/example_report.xml
通过在
中引用它来将 xml 文件加载到您的插件中/addons/example/__openerp__.py
在与其他 xml 文件的数据部分。
'data': ['views/example_report.xml'],
如果在您的插件的 ListView 中,您应该能够选择一条记录(选中复选框),然后在更多下拉列表中运行报告。或者在模型的表单 View 中,您还应该能够单击更多并从那里运行报告。
注意:必须正确安装 wkhtmltopdf 才能使其正常工作。 wkhtmltopdf.org 上有说明(确保版本至少为 0.12.1)
这是一个简单的 xml 报告定义。假设您有一个虚构的模型 example.model_name,其中包含名称 (char) 和子记录 (one2many),并且子记录模型具有 ID、名称和日期字段。
<openerp>
<data>
<report
id="report_example_model_name"
model="example.model_name"
string="Example Report"
name="example.report_example_report_view"
file="example.report_model_name"
report_type="qweb-pdf"/>
<template id="report_example_report_view">
<t t-call="report.html_container">
<!-- REMEMBER, docs is the selected records either in form view or checked in list view (usually). So the line below says use the following template for each record that has been selected. -->
<t t-foreach="docs" t-as="doc">
<t>
<div class="page">
<h1>Report For <t t-esc="doc.name"/></h1>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Date</th>
</tr>
<t t-foreach="doc.subrecord" t-as="o">
<tr>
<td><t t-esc="o.id"/></td>
<td><t t-esc="o.name"/></td>
<td><t t-esc="o.date"/></td>
</tr>
</t>
</table>
</div>
</t>
</t>
</t>
</template>
</data>
</openerp>
关于templates - 如何逐步创建 odoo 9.0 QWeb 报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39251425/
我想要输出 20 td 的 css 样式取决于 qweb var。是否有任何替代方法可以像这样复制整个代码: ... ... ... ... ... ... ... 因为此
我想在 qweb 模板中访问两个值 start_date 和 end_date。我如何才能在 qweb. 中使用这些值? 我正在生成然后将其发送到电子邮件。这是我创建报告的方式。 job_id = s
t字段选项不起作用。 我试过了 最佳答案 而不是使用 用 希望能有所帮助! 关于qweb - 如何在Odoo 10 QWeb报表中设置日期格式?,我们在Stack Overflow上找到一个类似
我想在 qweb 报告中添加分隔符“,”,以获得以下结果:session1,session2,session3 而不是:session1session2session3 这是我的代码:
我正在 Odoo 中开发一个模块。我需要更改发票报告以添加一些详细信息。 我使用带有位置属性的 xpath 并检查是否链接了事务以隐藏默认表。 hidden 这
我在 Qweb 报告中显示了一个浮点变量: 我想用产品价格 的小数精度对其进行舍入。我将它四舍五入到 4 位数字,因为我知道Product Price 的小数精度为 4 位数字,但正确的方法是从
我正在 Odoo 中开发一个模块。我需要更改发票报告以添加一些详细信息。 我使用带有位置属性的 xpath 并检查是否链接了事务以隐藏默认表。 hidden 这
我是报告 qweb 的新手,我想练习它,然后我尝试为我的模块 gestion_des_etudiants 创建报告,我知道我的代码中缺少一些东西,我需要你的帮助: report_etudiant.xm
我的问题是关于在 Odoo v8 中自定义 Qweb 报告,如果您检查图像 (Report Description),您会看到我有动态表,所以我的主要问题是如何通过调整主容器的大小来填充可用空间?有什
如何根据源文档字段名更改打印的qweb文件名?我在模型 stock.picking 中 因此,当我单击打印 -> 交货单时,将打印 qweb,但文件名将取决于源文档字段。在这里,我展示了解释我的意思的
我创建了一个向导,在其中放置了来自另一个启用了报告打印的模型的多对一字段[名称]。这里发生的情况是,当我选择一条记录并单击打印按钮时,它仅打印空报告。因此是否可以将数据提取到此处的报告中。 def
我想将“account.invoice”模型中的源文档“来源”字段添加到 qweb 报告中,但我不知道语法我只需要语法来添加这个字段我写的所有其他代码提前致谢。 class make_fields (
如何在 Odoo Qweb 报告中设置字体?目前,当我在 ubuntu 12.04 中开发报告时,报告的 PDF 副本看起来不错。但是,如果我在 ubuntu 14.04 中尝试同样的事情,字体看起来
如何减少qweb中的字符串长度? 示例: 返回stackoverflow我想删除最后8个字符并获取stack 最佳答案 关于odoo - 减少 qweb odoo 中的字符串长度,我们在Stack
我试图实现在字符串结果中有一个新行(回车),但到目前为止,我没有得到这个工作。 这个例子只是忽略了'\n'。 最佳答案 \n 正在工作 将 CSS "white-space: pre-wrap"添加
我想使用 Odoo 10 在报告的标题中插入 Logo 。 我测试过 和 它在 Odoo 8 中没有任何问题,但在 Odoo 10 中却没有。为什么会这样,我该如何解决? 最佳答案 如果你想使用公
我正在 account.invoice 模型中创建一个报告(qweb View ),并希望对每个发票行的一些字段进行求和,如下图所示: 问题是没有按照我想要的方式对字段求和。我该怎么办? cantid
有没有办法在循环 Qweb 中打印 python 字典中的键和值?例如,如果我有一个返回字典的函数: def get_informations(self): mydico={'myfirstk
我想做一个循环来打印元素精确的次数。像这样: ... 其中 o.label_qty 是一个整数。 但我只能在 qweb 中使用 t-foreach 循环: ... 有办法吗? 如果不是,我认为
Odoo v8 使用 Qweb,我们需要在发票的最后一页打印销售条款和条件。 据我所知,我们需要测试它是报告的最后一页,并在此页上打印一些静态 HTML。 有谁知道如何测试最后一页并从中删除页眉和页脚
我是一名优秀的程序员,十分优秀!