Skip to content
Snippets Groups Projects
Commit e6179a51 authored by smna-odoo's avatar smna-odoo Committed by Adrien Widart (awt)
Browse files

[FIX] stock: add SM without scheduled date

If a user adds a new SM to a picking without any scheduled date,
traceback will appear

To reproduce the issue:
1.  create a new picking and remove the scheduled_date.
2.  try to add a new storable product in move lines.

Error: A traceback appears: "TypeError: '>' not supported between
instances of 'datetime.datetime' and 'bool'"

On the picking form, the default SM date is the scheduled date of the
picking:
https://github.com/odoo/odoo/blob/2c3f53d5a0380e7de27977f56f20307ff2bccabf/addons/stock/views/stock_picking_views.xml#L358


Therefore, in the above use case, when triggering the onchange/compute
methods, the field `date` of the SM will not be defined. At some
point, we need to get the forecasted quantities of the SM product
(see the method updated by this commit) and, to do so, we compare
the SM date with `now`. Since this date is `False`, it will lead to the
above traceback

sentry-3979281197

closes odoo/odoo#121423

Signed-off-by: default avatarAdrien Widart (awt) <awt@odoo.com>
parent 77547263
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment