Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
2896 Vistas

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
Descartar
Autor

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

Autor Mejor respuesta

Yes I'm using Odoo sh

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

Avatar
Descartar
Mejor respuesta

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
oct 25
3353
1
may 25
1476
2
mar 25
7380
2
nov 24
2623
4
feb 24
13130