Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2881 Vistas

Hello Odoo community.

I have been asked to create a field that displays the date of the last purchase that the customer has made. There are pre-existing related fields that allow me to do that but the invoice model is for both invoices and sales so the date displayed even includes quotations.

I don't have much knowledge in Python but somehow I manage to intuit the scope of its logic. I know that it is possible to create a field that displays the date of the invoices according to their status: paid, partially paid, etc.

How could I create this field, what dependency would it have?

Avatar
Descartar
Mejor respuesta

Where are you trying to show the field?


You want to show the date of the latest purchase. This could mean one of several things:

- The date that the most recent sales order was confirmed

- The date of the last invoice

- The date of the last payment



I'll assume that you mean the date of the last invoice.

Therefore, the field you are looking for is: self.invoice_ids.date



If you have Odoo Studio you can add this by adding a 'Related Field' to the list view with the path Self > Invoices > Date

Avatar
Descartar
Autor

It can't be the last invoice cause it will include quotations too. I need to visualize the date when the invoice is shown as paid, not the date of the last payment, but the date when it goes to fully paid status.

I can assure you that :
self.invoice_ids.date or Self > Invoices > Date
does not include quotations or uninvoiced sales orders. It only includes invoices that have been created from a sales order.

Someone else may be able to help more with getting the last paid invoice date from the above path.

Publicaciones relacionadas Respuestas Vistas Actividad
3
feb 25
1800
1
dic 24
1996
2
mar 24
2327
2
mar 24
2878
0
sept 23
1447