2017-08-28 1 views
2

Il y a champ account.move.line.journal_id et je veux qu'il soit affiché dans le rapport.Ajouter un champ au rapport Qweb

je suis en train de

<tr t-foreach="p.account_move_line" t-as="p"> 
       <span t-esc="p.journal_id"/> 
       </tr> 

ou quelque chose comme ça.

<tr t-foreach="p.account_invoice.payment_move_line_ids" t-as="p"> 
       <span t-esc="p.journal_id"/> 

mais obtenir erreur

AttributeError: 'NoneType' object has no attribute 'account_move_line' 

Error to render compiling AST 
AttributeError: 'NoneType' object has no attribute 'account_move_line' 
Template: account.report_invoice_document 
Path: /templates/t/t/div/div[4]/div[2]/table/tr[2]/td[2]/tr 
Node: <tr t-foreach="p.account_move_line" t-as="p"> 
       <span t-esc="p.journal_id"/> 
       </tr> 

Répondre

3

Dans t-foreach vous devez avoir la liste que vous voulez itérer. Je pense que l'erreur est que vous assignez la valeur à p et en même temps vous itérez par cette variable. Essayez de changer la variable (ce qui prend en compte que p est votre dossier de account_invoice, sinon vous pouvez accéder directement sans t-foreach):

<tr t-foreach="p.account_move_line" t-as="j"> 
    <span t-esc="j.journal_id"/> 
</tr> 

J'espère que je l'ai aidé;)