Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
2755 Vizualizări

Hello there,

I would like to display an array with payments details in my customer's invocies.

Can someone helps me to achieve this with Odoo studio or with a selfmade custom module ?

I want to display the payment date, amount and payment method of each payment for 1 invoice at the end of my invoice's report.

I'm using Odoo 16 on Odoo SH.

Thank you in advance,


Aymerick

Imagine profil
Abandonează
Cel mai bun răspuns

Hi Cybrosys,

Thanks for the code.

I created a custom module for v18 CE to test and managed to install it.

When displaying front end invoice i got this error :

Error while render the template
AttributeError: 'account.move' object has no attribute 'payment_details'
Template: account.report_invoice_document
Path: /t/t/div[2]/div/div[4]/t[2]/t
Node: <t t-esc="o._get_name_invoice_report()"/>

Imagine profil
Abandonează
Cel mai bun răspuns

Hi

Add this code of invoice template.xml to your custom module

<template id="report_invoice_inherits"
            inherit_id="account.report_invoice_document">

      <xpath expr="//div[@name='payment_term']" position="after">
              <t t-if="o.payment_details">
                 <center><strong style="font-size:20px;">Payment Details</strong></center>
                  <t t-esc="o._get_name_invoice_report()"></t>
                  <br/>
                  <table class="table table-sm o_main_table" name="payment_details_table" style="background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;">
                      <thead>
                          <tr>
                              <th name="th_sl_no" class="text-center" style="width:50px"><span>SL No</span></th>
                              <th name="th_payment_reference" t-attf-class="text-center {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" style="width:200px"><span>Payment Ref</span></th>
                              <th name="th_payment_date" t-attf-class="text-center {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" style="width:100px"><span>Date</span></th>
                              <th name="th_payment_method" t-attf-class="text-center {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" style="width:140px"><span>Payment Method</span></th>
                              <th name="th_amount_paid" t-attf-class="text-center {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" style="width:110px"><span>Amount Paid</span></th>
                          </tr>
                      </thead>
                      <tbody class="payment_details_table">
                          <t t-foreach="payments_vals" t-as="value">
                              <tr>
                                  <td><t t-esc="value_index+1"/></td>
                                  <td><t t-esc="value.get('ref')"/></td>
                                  <td><t t-esc="value.get('date')"/></td>
                                  <td><t t-esc="value.get('journal_name')"/></td>
                                  <td><t t-esc="value.get('amount')"/></td>
                              </tr>
                          </t>
                      </tbody>
                  </table>
              </t>
      </xpath>
  </template>





Hope it helps

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
mar. 25
1229
1
apr. 24
3258
2
feb. 24
3507
1
feb. 24
2241
1
mar. 24
1475