Odoo Help


Invoice date same as sales order date

Noah Alama
on 11/2/16, 5:00 PM 813 views

Hello, is there a way to make invoices' date be the same as sales orders' date?

We are using Odoo 8 and we have a big problem in terms of creating invoices for our customers and setting the invoice to have the sales order's date would save us so much time and trouble.

If no solution, can we at least change invoice date before printing? This is very labor intensive, but would also do the trick as well.

Thanks a lot for any help and please, if you have questions, don't hesitate to ask me.

Ahmed M.Elmubarak
On 11/3/16, 2:23 AM

Hello Again Noah :)

Actually the invoicing date takes the 'current date of pressing the create invoice button' and you can check this here in the wizard 

and this will be passed cross multiple functions starting from here. So to solve this you can change the value of this field 'invoice date' to the SO's date. Or you can modify the function that creates the invoice which you can modify the create dict from here 


Try to update this line to be as:

'date_invoice': order.date_order or order.create_date or context.get('date_invoice', False),

Hope this will give you some clues ...

Hello Ahmed, thanks so much for answering my question. I do understand what you are talking about, but my Python skills are non-existent! Can you please give me lines or pieces of code to change, that would help me a lot.

Just tell me what files to change on my Odoo server, thanks a lot for all your efforts.

Noah Alama
on 11/3/16, 2:42 AM

Hi, Actually I'vn't Odoo 8 instance right now , I'll try to update my answer later on when it is available ... /

Ahmed M.Elmubarak
on 11/3/16, 3:19 AM

Thanks a lot for your very valuable help, I was looking at https://github.com/odoo/odoo/blob/8.0/addons/sale/sale.py#L205 in the hope of understanding where I can get the SO's date snippet, no luck, I have no idea where to start! :)

Noah Alama
on 11/3/16, 3:26 AM

Hi, I've updated my answer. I'm still can't check this on v8, so check it and feedback :

Ahmed M.Elmubarak
on 11/3/16, 6:29 AM

God bless you, it works :) :)

Noah Alama
on 11/3/16, 7:35 AM

Glad that is works for you :)

Ahmed M.Elmubarak
on 11/3/16, 9:12 AM
On 11/2/16, 11:47 PM

You can change 'invoice date' before you validate an invoice

or try this on code
add this line in 'def _prepare_invoice' function>>invoice_vals ={}

ie in sale.py file line no between 237-250

'date_invoice': order.order_date.date()

Yes, this would work, but I'm interested in an automatic solution, with as little human intervention as possible.

Noah Alama
on 11/3/16, 1:07 AM

Thanks for your help.

Noah Alama
on 11/3/16, 7:39 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 11/2/16, 5:00 PM
Seen: 813 times
Last updated: 11/3/16, 7:35 AM