html - 如何在odoo报告中添加一个字段?

标签 html css report odoo qweb

enter image description here我需要为每个员工打印一份时间表报告,我需要在标题而不是列单元格上显示员工姓名,因为它会在每一行中重复,我不需要那个

我尝试使用 < t-foreach > 但它显示的名称太多了

<template id="19011.employee">
  <t t-call="web.html_container">
    <t t-call="web.external_layout">
      <div class="page">
        <div class="text-center">
          <h2> <strong>TIME SHEET</strong>
          </h2>
          <h2>
            <tr t-foreach="docs" t-as="o">
              <span t-field="o.employee_id" />
            </tr>
          </h2>
        </div>
        <table class="table table-condensed" bgcolor="#875A7B">
          <tr>
            <th> check in</th>
            <th> check out</th>
            <th> Total</th>
          </tr>
          <tr t-foreach="docs" t-as="o">
            <td>
              <t t-esc="o.check_in" />
            </td>
            <td>
              <t t-esc="o.check_out" />
            </td>
            <td>
              <t t-esc="o.total" />
            </td>
          </tr>
          <tr bgcolor="#875A7B">
            <td align="center"> <strong> Total Hours</strong></td>
            <td></td>
            <td>
              <strong t-esc="sum([o.total for o in docs])" />
            </td>
          </tr>
        </table>
      </div>
    </t>
  </t>
</template>

我需要它在标题或第一行的第一列显示 employee_id 而不重复显示

最佳答案

请使用以下代码:

<template id="19011.employee">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
    <h2> <strong>TIME SHEET</strong>
    </h2>
        <t t-foreach="docs" t-as="o">
        <div class="text-center">

        <h2>
            <span t-field="o.employee_id" />
        </h2>
        </div>
        <table class="table table-condensed" bgcolor="#875A7B">
            <tr>
                <th> check in</th>
                <th> check out</th>
                <th> Total</th>
            </tr>
            <tr>
                <td>
                <t t-esc="o.check_in" />
                </td>
                <td>
                <t t-esc="o.check_out" />
                </td>
                <td>
                <t t-esc="o.total" />
                </td>
            </tr>

        </table>
    </t>
    <tr bgcolor="#875A7B">
        <td align="center"> <strong> Total Hours</strong></td>
        <td></td>
        <td>
        <strong t-esc="sum([o.total for o])" />
        </td>
    </tr>
</div>
    </t>
</t>

关于html - 如何在odoo报告中添加一个字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57499506/

相关文章:

report - odoo 14 上的自定义模块安装错误

javascript - 函数只运行一次

css - 子导航与最长的子项一样长

c# - RDLC vs Crystal Reports vs Anything Else 免费 : I'm running Informix and using C# 4. 0

javascript - 通过 async 和 defer 属性提高页面速度

css - 将弹出窗口转换为相对窗口不起作用

oracle - 为什么没有 oracle Forms 或 Reports 反编译器? (技术上)

html - CSS:元素在 float div 上溢出

html - 如何制作 100% 高度的侧边栏覆盖页眉但同时不覆盖页脚

html - 确保 div 为 100% 宽度,而不会破坏菜单