我试图重新设计我的Odoo 9 qweb报告。继承了sale_order_report。我创建了一些在qweb上调用的python函数。现在我想隐藏python函数的内容取决于条件。请花一点时间阅读下面的代码,并帮我指出解决问题的具体方法?
<groupId>xx.xx</groupId>
<artifactId>xxxxx</artifactId>
<packaging>war</packaging>
<version>1</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.5.10.1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.7.Final</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
<build>
<finalName>starserv</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warName>${project.artifactId}</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.0.M2</version>
<configuration>
<scanIntervalSeconds>5</scanIntervalSeconds>
<war>${project.basedir}/target/${project.artifactId}.war</war>
<webApp>
<webInfIncludeJarPattern>^$</webInfIncludeJarPattern>
<containerIncludeJarPattern>^$</containerIncludeJarPattern>
</webApp>
</configuration>
</plugin>
</plugins>
</build>
感谢您的时间。
答案 0 :(得分:1)
通过像这样的t-if语句包围模板中的代码
<t t-if="condition"> <!-- if the condition is true the contenant is shown -->
<....code that calls the method and show the value on the template />
</t>