Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
2894 Tampilan

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
Buang
Penulis

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

Penulis Jawaban Terbai

Yes I'm using Odoo sh

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

Avatar
Buang
Jawaban Terbai

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Okt 25
3352
1
Mei 25
1474
2
Mar 25
7379
2
Nov 24
2615
4
Feb 24
13126