Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3033 Lượt xem

Dear Community,

i'd like to change Description line in pdf invoice - i'd like to show product SCU instead of description.

here what i have in report_invoice_document:
<div class="row mt32 mb32"> <div class="col-xs-2" t-if="o.name"> <strong>Description:</strong> <p t-field=" <div class="row mt32 mb32"> <div class="col-xs-2" t-if="o.name"> <strong>Description:</strong> <p t-field="o.name"/> </div>"/> </div>

when i'm trying to change o.name to o.product_id - i'm getting 503 server error.

probably i missed something, pls advice how to do it?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Thanks Mitul, but unfortunately it's not working. Here is corrects answer, which i get on stackexchange forum:

>>>

You are trying to change o.name that refers to the name of the invoice record with o.product_idthat it's not a field of the account.invoice model, it's a field of the account.invoice.line model that it's backed by the field invoice_line_ids on the account.invoice model.

You will need to use it for example to change the line:

<td><span t-field="l.name"/></td>

With:

<td><span t-field="l.product_id.name"/></td>

>>>

Ảnh đại diện
Huỷ bỏ

I should start to answer question here again. You should provide the link to my answer on stackoverflow:

https://stackoverflow.com/questions/52835167/odoo10-how-to-change-line-in-pdf-invoice/52838321#52838321

Câu trả lời hay nhất

Hello,

 try with below code

 <div class="row mt32 mb32">
     <div class="col-xs-2" t-if="o.name">
      <strong>Description:</strong>
          <p t-field="o.product_id.your_field_name"/>
     </div>
</div>
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 7 25
526
1
thg 8 25
1335
1
thg 6 24
2226
2
thg 10 17
5658
0
thg 1 25
950