2016-06-07 10 views
1

zu laufen habe ich diesen Fehler, wenn ich versuche, diesen Bericht auszuführen, die in mako Vorlage geschrieben:Jinja Fehler beim Versuch mako Vorlage in 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> 

Es funktioniert gut in OpenERP 7, aber in odoo 8 didn‘ t arbeiten.

   <% 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 

Antwort

1

Seit Odoo V8 müssen Sie die verwendete Syntax ändern und es scheint, ist es sehr schwer ist, solche Dinge mit jinja2 zu tun. Hier ein Beispiel, das mit einem Kundenauftrag in Odoo V9 getestet wurde:

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