[FIX] point_of_sale: Convert shipping_date to datetime correctly before creating procurement.
Since shipping_date is a Date but date_planned is a datetime, before this commit, the date_planned in picking was one day less. complementary to https://github.com/odoo/odoo/commit/fe9e230b500af316e6f80af453a4073d9dff24b7 closes odoo/odoo#154533 Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>
This commit is contained in:
committed by
Carlos Lopez
parent
b104a50d6d
commit
5439cfcc40
@@ -1418,7 +1418,13 @@ class PosOrderLine(models.Model):
|
||||
self.ensure_one()
|
||||
# Use the delivery date if there is else use date_order and lead time
|
||||
if self.order_id.shipping_date:
|
||||
date_deadline = self.order_id.shipping_date
|
||||
# get timezone from user
|
||||
# and convert to UTC to avoid any timezone issue
|
||||
# because shipping_date is date and date_planned is datetime
|
||||
from_zone = pytz.timezone(self._context.get('tz') or self.env.user.tz or 'UTC')
|
||||
shipping_date = fields.Datetime.to_datetime(self.order_id.shipping_date)
|
||||
shipping_date = from_zone.localize(shipping_date)
|
||||
date_deadline = shipping_date.astimezone(pytz.UTC).replace(tzinfo=None)
|
||||
else:
|
||||
date_deadline = self.order_id.date_order
|
||||
|
||||
|
||||
Reference in New Issue
Block a user