Skip to content

[18.0][MIG] sale_order_safe_commitment_date: Migration to 18.0#4086

Open
chienandalu wants to merge 5 commits into
OCA:18.0from
moduon:18.0-mig-sale_order_safe_commitment_date
Open

[18.0][MIG] sale_order_safe_commitment_date: Migration to 18.0#4086
chienandalu wants to merge 5 commits into
OCA:18.0from
moduon:18.0-mig-sale_order_safe_commitment_date

Conversation

@chienandalu

@chienandalu chienandalu commented Dec 23, 2025

Copy link
Copy Markdown
Member
  • Now product lead times are integers, so we better deal with whole days instead.
  • Added a sales cutt-off calendar so we can avoid salesmen scheduling deliveries that won't reach on time.

https://www.loom.com/share/3f582ee0d01b4130ad0d61db275b254f

cc @moduon MT-12188

@chienandalu
chienandalu force-pushed the 18.0-mig-sale_order_safe_commitment_date branch from cb3cd7b to db19253 Compare January 2, 2026 09:19
@rousseldenis

Copy link
Copy Markdown
Contributor

/ocabot migration sale_order_safe_commitment_date

@rousseldenis

Copy link
Copy Markdown
Contributor

@chienandalu Could you check tests ?

Users who set the delivery date expect it to be present in order to be able
to filter by it.

MT-9790
The delivery date is computed by default from the expected date.
We can still edit it, but if can't be delivered, it will be force
on confirmation.

MT-9790
When the lead time has decimals (for example, 1.5 = 36 hours) a lot of false
positives are raised for the delivery exceptions. as the default hour for the
delivery date is the current one. For example: in that case if the current hour
is 01:00, the expected date will be 13:00 for the next day, but when we set the
delivery date for tomorrow, the default hour will be tomorrow at 1:00, which is
before that expected day. The users tend to ignore the warnings after stumbling
upon these cases over and over.

So now:

- There's a new delivery date helper field to simply set the date (no time) that
  sets the hour to 23.59.59 for the delivery date (commitment_date)
- The delivery date can be still changed manually whenever that info is important
  as usal in the standard.

MT-9790
@chienandalu
chienandalu force-pushed the 18.0-mig-sale_order_safe_commitment_date branch 4 times, most recently from e4c0872 to 5fccf9e Compare February 3, 2026 10:58
@chienandalu
chienandalu force-pushed the 18.0-mig-sale_order_safe_commitment_date branch from 5fccf9e to 549f93d Compare February 3, 2026 12:22

@alexey-pelykh alexey-pelykh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice module! The cut-off calendar approach using resource.calendar is smart — it leverages existing Odoo infrastructure rather than reinventing scheduling logic.

The _inverse_date_for_commitment setting time to 00:00 of the day in user TZ and converting to UTC is the correct pattern for date-to-datetime fields. Tests with freezegun properly validate the cut-off scenarios.

Code review LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants