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

Hi,

When a sales agent opens a new sales order, I would like to default the delivery date to tomorrows date.

E.g. Automatically set the "Requested Date" field under the "Other Information" tab to today's date + 1 (tomorrow).

Currently its always blank, most of our orders are next day, barring the odd one....

Thanks

Avatar
Discard
Best Answer

Hello Clark,

You can write as following  :

from odoo import models,api
from datetime import datetime,timedelta

class Sale_order(models.Model):
    _inherit = "sale.order"
    
    @api.model
    def create(self,vals):
        today = datetime.today()
        requested_date = today + timedelta(days=1)
        vals['requested_date']=requested_date.strftime("%Y-%m-%d %H:%M:%S")
        return super(Sale_order,self).create(vals)

Thanks,

Avatar
Discard
Best Answer

Dear Clark ,

    According to my knowledge , There is no such option.However I think you can do it by a small customization.

    Hope it will help.

Avatar
Discard
Best Answer

Hi Clark,

Just try this out..

Leave the Requested Date empty. Go to Inventory->Settings->Advanced Scheduling->Scheduling Lead Time for Sales.

Set the "Move forward expected delivery date" by to "-1.00" days.

Then automatically it will be next day's date in delivery validation form.


Hope this will help.

Thanks

Avatar
Discard
Related Posts Replies Views Activity
3
Aug 16
6953
1
Dec 24
185
2
Mar 24
695
2
Mar 24
1330
0
Sep 23
354