2016-06-07 1 views
1

J'ai eu cette erreur lorsque je tente d'exécuter ce rapport qui écrit dans le modèle mako:erreur Jinja lorsque vous essayez d'exécuter modèle Mako dans 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> 

Il fonctionnait très bien dans OpenERP 7 mais Odoo 8 n » ai pas t travail.

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

Répondre

1

Depuis Odoo V8 vous devez changer la syntaxe utilisée et il semble qu'il est très difficile de faire des choses avec jinja2. Voici un exemple testé avec une commande client dans Odoo V9:

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