2016-06-07 82 views
1

运行Mako的模板,我得到这个错误,当我尝试运行此报告,写的真子模板:神社错误时尝试在Odoo

Encountered unknown tag 'total_price'. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'. 

<class 'jinja2.exceptions.TemplateSyntaxError'>,Encountered unknown tag 'total_price'. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'.,<traceback object at 0x02F2F490> 

它在OpenERP的7,但在odoo 8做工精细没”工作。

   <% total_price = 0.0 %> 
       %for line_container_ids in shipping.container_line_ids: 
        <% 
         total_price = line_container_ids.product_qty * line_container_ids.net_price 
         curr = line_container_ids.currency_id.name 
        %> 
       % endfor 

回答

1

由于Odoo V8您需要更改所使用的语法,它似乎也很难做这样的事情的Jinja2。这里用Odoo V9中的销售订单测试一个示例:

% set total_price = [] 
% for line in object.order_line: 
    % if total_price.append(line.price_subtotal) 
    % endif 
% endfor 
${sum(total_price)}