【问题标题】:Qweb report : Error to render compiling AST, Memory errorQweb 报告:渲染编译 AST 时出错,内存错误
【发布时间】:2020-07-04 05:44:40
【问题描述】:

在打印自定义 qweb 报告时,我在 odoo 10 中遇到以下错误

Error to render compiling AST
MemoryError: 
Template: report.html_container
Path: /templates/t/t[2]/t
Node: <t t-raw="0"/>

我正在向 xml.my 代码发送 2 个列表和 1 个字典

<t t-foreach="qlty" t-as="q">
     <t t-foreach="qlty_des" t-as="qld">
          <t t-foreach="val" t-as="prd">
                 <tr style="border:1px solid black;">
                    <t t-if="prd['quality'] == q">
                           <t t-if="prd['quality'] == qld[0]">
                                <t t-if="prd['design'] == qld[1]">
                                  <td width="16%"  class="text-center">
                                           <span t-esc="prd['size']" />
                                  </td>
                                                              
                                  <td width="16%"  class="text-center">
                                       <span t-esc="prd['bs_col']" />
                                  </td>
                                                              
                                  <td width="16%"  class="text-center">
                                      <span t-esc="prd['brd_col']" />
                                  </td>
                                                              
                                  <td width="15%"  class="text-center">
                                      <span t-esc="prd['quantity']" />
                                  <t t-set="quantity" t-value="quantity + prd['quantity']" />
                                  /td>
                                                              
                                    <td width="15%"  class="text-center">
                                                            
                                       <span t-esc="prd['area']" />
                                    <t t-set="area" t-value="area + prd['area']" />
                                                               
                                   </td>
                                                              
                                                              
                             </t><!-- end of "prd['design'] == qld[1]-->  
                       </t><!-- end of "prd['quality'] == qld[0]-->   
                    </t> <!-- end of prd['quality'] == q"-->
                                                    
               </tr>
         </t>
        </t>
        <t t-set="ql_count" t-value="0"/> 
     </t>   

此代码适用于较少的记录打印。但是当记录数量增加时,我的系统会挂起并发生上述错误。 请建议如何解决它

【问题讨论】:

  • 看起来像循环中的问题。您有 3 次循环迭代,当您有最大记录要打印时,它无法通过逻辑实现一些不匹配 [数据和条件] 获取并报告打印停止。

标签: python xml odoo odoo-10 qweb


【解决方案1】:

发生内存错误意味着您的程序以某种方式创建了太多对象。

请优化您的 python 代码,您的变量包含太多无法处理的数据。

  • 另一种解决方案是在您的系统(32 位或 64 位)上,但我个人认为您需要优化您的 python 代码。

【讨论】:

    猜你喜欢
    • 2019-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-30
    • 2020-11-22
    相关资源
    最近更新 更多