diff --git a/frepple/controllers/inbound.py b/frepple/controllers/inbound.py index 1310981b..c81cbd5c 100644 --- a/frepple/controllers/inbound.py +++ b/frepple/controllers/inbound.py @@ -174,13 +174,31 @@ def run(self): st = elem.get("start") if st: try: - wo["start"] = datetime.strptime(st, "%Y-%m-%d %H:%M:%S") + wo["start"] = ( + self.timezone.localize( + datetime.strptime( + st, + "%Y-%m-%d %H:%M:%S", + ) + ) + .astimezone(UTC) + .replace(tzinfo=None) + ) except Exception: pass nd = elem.get("end") if st: try: - wo["end"] = datetime.strptime(nd, "%Y-%m-%d %H:%M:%S") + wo["end"] = ( + self.timezone.localize( + datetime.strptime( + nd, + "%Y-%m-%d %H:%M:%S", + ) + ) + .astimezone(UTC) + .replace(tzinfo=None) + ) except Exception: pass wo_data.append(wo) @@ -209,13 +227,27 @@ def run(self): quantity = float(elem.get("quantity")) date_planned = elem.get("end") if date_planned: - date_planned = datetime.strptime( - date_planned, "%Y-%m-%d %H:%M:%S" + date_planned = ( + self.timezone.localize( + datetime.strptime( + date_planned, + "%Y-%m-%d %H:%M:%S", + ) + ) + .astimezone(UTC) + .replace(tzinfo=None) ) date_ordered = elem.get("start") if date_ordered: - date_ordered = datetime.strptime( - date_ordered, "%Y-%m-%d %H:%M:%S" + date_ordered = ( + self.timezone.localize( + datetime.strptime( + date_ordered, + "%Y-%m-%d %H:%M:%S", + ) + ) + .astimezone(UTC) + .replace(tzinfo=None) ) # Is that an update of an existing PO ? @@ -390,12 +422,19 @@ def run(self): continue if date_shipping: - date_shipping = datetime.strptime( - date_shipping, "%Y-%m-%d %H:%M:%S" + date_shipping = ( + self.timezone.localize( + datetime.strptime( + date_shipping, + "%Y-%m-%d %H:%M:%S", + ) + ) + .astimezone(UTC) + .replace(tzinfo=None) ) else: - date_shipping = datetime.strptime( - datetime.now(), "%Y-%m-%d %H:%M:%S" + date_shipping = ( + datetime.now().astimezone(UTC).replace(tzinfo=None) ) if not hasattr(self, "stock_picking_dict"): self.stock_picking_dict = {} @@ -569,8 +608,6 @@ def run(self): # Remember odoo name for the MO reference passed by frepple. # This mapping is later used when importing WO. mo_references[elem.get("reference")] = mo - mo._onchange_workorder_ids() - mo._onchange_move_raw() mo._create_update_move_finished() # mo.action_confirm() # confirm MO # mo._plan_workorders() # plan MO