Skip to Content
Menu
This question has been flagged
3 Replies
2409 Views

Hello,

By default, Odoo puts today's datetime as the order date when it is confirmed,

I understand that in order to change this behaviour, i have to make changes directly in the source code under the file  sale..py.

I have looked everywhere on Odoo Editor and could not find this file.

Can someone guide me please ?

I am using Odoo sh V16 Entreprise

Thanks

Avatar
Discard
Author

Thanks for the prompt response,

where can i find the date_order field please? what line is it on ?

and once i make the changes, is it necessary to restart the server ? if yes how ?

I'm not a technical person per se, I'm just trying to solve this problem for my teammate.

Thank you!

as you are using odoo sh, you cannot directly edit the source code, even on premise it is not recommended, to achieve this you need to know tech side of odoo like creating a module.

odoo/addons/sale/models/sale_order.py line number 815

Author Best Answer

Yes I'm using Odoo sh

So there is no other way to change the order date but through a technical intervention ?

Avatar
Discard
Best Answer

Hi,
You can achieve this by editing the date_order field and creating a custom dictionary in the file sale_order.py in the module sale.
You need to change it as follows:
READONLY_FIELD_STATES_CUSTOM = {
    state: [('readonly', False)]
    for state in {'sale', 'done', 'cancel'}
}

Add this dictionary just after the imports.
Then change the date_order field as follows:
date_order = fields.Datetime(
        string="Order Date",
        states=READONLY_FIELD_STATES_CUSTOM,
        copy=False, required=True,
        help="Creation date of draft/sent orders,\nConfirmation date of "
             "confirmed orders.")

Hope it helps

Avatar
Discard
Best Answer

Hi,

You can find the related code in odoo/addons/sale/models/sale_order.py line number 815.

self.write(self._prepare_confirmation_values())



Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
May 25
821
2
Mar 25
6039
2
Nov 24
2022
0
May 25
2278
4
Feb 24
12137