Odoo 12报告样本

时间:2019-10-03 16:49:01

标签: odoo odoo-12 qweb

我正在尝试进行报告,但是不使用 "arbUnicodeGen" should "generate fixed length arbitrary strings" in { forAll(arbUnicodeGen(10)) { s => println(s) } } 10:52:27 PM: Build ready to start 10:52:29 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63 10:52:29 PM: build-image tag: v3.3.2 10:52:29 PM: buildbot version: 16db6527b4cafa2553c3f3f11aa8d1b46a72ff40 10:52:30 PM: Fetching cached dependencies 10:52:30 PM: Failed to fetch cache, continuing with build 10:52:30 PM: Starting to prepare the repo for build 10:52:31 PM: No cached dependencies found. Cloning fresh repo 10:52:31 PM: git clone git@gitlab.com:[deleted by me!] 10:52:32 PM: Preparing Git Reference refs/heads/master 10:52:32 PM: Found netlify.toml. Overriding site configuration 10:52:32 PM: Starting build script 10:52:32 PM: Installing dependencies 10:52:34 PM: Downloading and installing node v10.16.3... 10:52:34 PM: Downloading https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz... 10:52:34 PM: ##### 10:52:34 PM: 7.6% 10:52:34 PM: ######################################### 10:52:34 PM: ######################## 90.4% 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: # 10:52:34 PM: ######################## 10:52:34 PM: ############ 100.0% 10:52:34 PM: Computing checksum with sha256sum 10:52:35 PM: Checksums matched! 10:52:37 PM: Now using node v10.16.3 (npm v6.9.0) 10:52:37 PM: Attempting ruby version 2.6.2, read from environment 10:52:39 PM: Using ruby version 2.6.2 10:52:39 PM: Using PHP version 5.6 10:52:39 PM: Started restoring cached node modules 10:52:39 PM: Finished restoring cached node modules 10:52:39 PM: Installing NPM modules using NPM version 6.9.0 10:53:08 PM: > sharp@0.22.1 install /opt/build/repo/gatsbyjs-starter-tailwindplay/node_modules/sharp 10:53:08 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy) 10:53:09 PM: info 10:53:09 PM: sharp 10:53:09 PM: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.4/libvips-8.7.4-linux-x64.tar.gz 10:53:11 PM: > core-js@2.6.9 postinstall /opt/build/repo/gatsbyjs-starter-tailwindplay/node_modules/core-js 10:53:11 PM: > node scripts/postinstall || echo "ignore" 10:53:11 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library! 10:53:11 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 10:53:11 PM: > https://opencollective.com/core-js 10:53:11 PM: > https://www.patreon.com/zloirock 10:53:11 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -) 10:53:11 PM: > core-js-pure@3.1.4 postinstall /opt/build/repo/gatsbyjs-starter-tailwindplay/node_modules/core-js-pure 10:53:11 PM: > node scripts/postinstall || echo "ignore" 10:53:11 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library! 10:53:11 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 10:53:11 PM: > https://opencollective.com/core-js 10:53:11 PM: > https://www.patreon.com/zloirock 10:53:11 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -) 10:53:12 PM: > gatsby-telemetry@1.1.0 postinstall /opt/build/repo/gatsbyjs-starter-tailwindplay/node_modules/gatsby-telemetry 10:53:12 PM: > node src/postinstall.js 10:53:14 PM: npm 10:53:14 PM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents): 10:53:14 PM: npm 10:53:14 PM: WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 10:53:14 PM: added 1591 packages from 877 contributors and audited 21387 packages in 33.175s 10:53:14 PM: found 529 vulnerabilities (527 high, 2 critical) 10:53:14 PM: run `npm audit fix` to fix them, or `npm audit` for details 10:53:14 PM: NPM modules installed 10:53:14 PM: Started restoring cached go cache 10:53:14 PM: Finished restoring cached go cache 10:53:14 PM: unset GOOS; 10:53:14 PM: unset GOARCH; 10:53:14 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64'; 10:53:14 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}"; 10:53:14 PM: go version >&2; 10:53:14 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env'; 10:53:14 PM: go version go1.12 linux/amd64 10:53:14 PM: Installing missing commands 10:53:14 PM: Verify run directory 10:53:14 PM: Executing user command: npm run build 10:53:14 PM: > @oddstronaut/gatsby-starter-tailwind@3.0.25 build /opt/build/repo/gatsbyjs-starter-tailwindplay 10:53:14 PM: > yarn run clean && gatsby build 10:53:14 PM: sh: 1: yarn: not found 10:53:14 PM: npm 10:53:14 PM: ERR! file sh 10:53:14 PM: npm ERR! code ELIFECYCLE 10:53:14 PM: npm ERR! errno 10:53:14 PM: ENOENT 10:53:14 PM: npm ERR! syscall spawn 10:53:14 PM: npm 10:53:14 PM: ERR! @oddstronaut/gatsby-starter-tailwind@3.0.25 build: `yarn run clean && gatsby build` 10:53:14 PM: npm ERR! spawn ENOENT 10:53:14 PM: npm ERR! 10:53:14 PM: npm ERR! Failed at the @oddstronaut/gatsby-starter-tailwind@3.0.25 build script. 10:53:14 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 10:53:14 PM: npm 10:53:14 PM: ERR! A complete log of this run can be found in: 10:53:14 PM: npm ERR! 10:53:14 PM: /opt/buildhome/.npm/_logs/2019-10-03T20_53_14_985Z-debug.log 10:53:14 PM: Skipping functions preparation step: no functions directory set 10:53:14 PM: Caching artifacts 10:53:14 PM: Started saving node modules 10:53:15 PM: Finished saving node modules 10:53:15 PM: Started saving pip cache 10:53:15 PM: Finished saving pip cache 10:53:15 PM: Started saving emacs cask dependencies 10:53:15 PM: Finished saving emacs cask dependencies 10:53:15 PM: Started saving maven dependencies 10:53:15 PM: Finished saving maven dependencies 10:53:15 PM: Started saving boot dependencies 10:53:15 PM: Finished saving boot dependencies 10:53:15 PM: Started saving go dependencies 10:53:15 PM: Finished saving go dependencies 10:53:17 PM: Error running command: Build script returned non-zero exit code: 1 10:53:17 PM: Failing build: Failed to build site 10:53:17 PM: failed during stage 'building site': Build script returned non-zero exit code: 1 10:53:18 PM: Finished processing build request in 48.202499427s ,因为它们中包含标题。我想拥有自己的页眉和页脚。

我尝试使用external_layout,因为与其他布局相比,它似乎不那么忙碌。

但是我一直遇到错误internal_layout

这是我的代码

minimal_layout

如何使用body_parent = root.xpath('//main')[0] IndexError: list index out of range - - -?还是应该使用其他布局?

2 个答案:

答案 0 :(得分:2)

要创建模板报告时,至少需要调用"web.html_container"巫婆调用"web.report_layout"巫婆定义Minal Report layout

报告模板的所有css文件都应添加到report_assets_common模板中:

<template id="assets_common" name="a proper name for your template purpuse" inherit_id="web.report_assets_common">
    <xpath expr="." position="inside">
        <link rel="stylesheet" type="text/scss" href="/fhid_recruitment/static/src/css/applicant-contract.css"/>
    </xpath>
</template>

最好将页眉和页脚提取到模板中,以便在external_layout之类的多个报表中使用它们,您可以查看external_layout_standard以获得基本的想法。

<template id="external_layout">
    <div class="header">
        My Header
    </div>
    <!-- everything inside t-call="fhid_recruitment.external_layout" will be rendered here -->
    <t t-raw="0" />

    <div class="footer">
        My footer
    </div>
</template>

在模板中,只需在此处调用您的自定义外部布局即可:

<template id="applicant_contract_offering">
    <t t-call="web.html_container">
        <!-- because it's defined in this module "fhid_recruitment" -->
        <t t-call="fhid_recruitment.external_layout">
           <t t-foreach="docs" t-as="o">
               <div call="page">
                    <div class="article">
                        Content
                    </div>
                </div>
            </t>
        </t>
    </t>
</template>

关于模板,您需要了解的最重要的知识之一是<t t-raw="0" />,例如,当我们这样称呼模板x_template时,它就是这样的:

<t t-call="x_template">
    any_content
</t>

Qweb引擎将要做的是,在呈现报告时,将<t t-raw="0" />内的x_template替换为any_content

为简化操作,如果您仅对一个模板使用页眉和页脚:

<template id="applicant_contract_offering">
    <t t-call="web.html_container">
        <t t-foreach="docs" t-as="o">
            <div class="header">
                My Header
            </div>
            <div class="article">
                Content
            </div>
            <div class="footer">
                My footer
            </div>
        </t>
    </t>
</template>

答案 1 :(得分:1)

您可以继承-11external_layout并使用您的自定义代码覆盖默认行为。并在您的报告中使用它。