Skip to Content
Menu
This question has been flagged
1 Reply
1904 Views

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
Discard
Best Answer

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
Discard
Author

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.

Related Posts Replies Views Activity
1
Oct 24
183
2
Mar 24
689
2
Mar 24
1322
0
Sep 23
354
1
Sep 23
458