Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
2897 Widoki

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

Awatar
Odrzuć
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 Najlepsza odpowiedź

Yes I'm using Odoo sh

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
paź 25
3353
1
maj 25
1477
2
mar 25
7380
2
lis 24
2627
4
lut 24
13130