minor fix

This commit is contained in:
Wilson Gomez 2023-08-16 09:21:13 -05:00
parent c9a687809f
commit 4a6c63fadd
2 changed files with 5 additions and 5 deletions

View File

@ -377,7 +377,10 @@ class TableModel(QAbstractTableModel):
mod_hours = value_obj + timedelta(hours=DELTA_LOCALE)
val = mod_hours.strftime('%d/%m/%Y %I:%M %p')
elif data['type'] == 'time':
value_obj = datetime.strptime(val, '%Y-%m-%dT%H:%M:%S.%f')
try:
value_obj = datetime.strptime(val, '%Y-%m-%dT%H:%M:%S.%f')
except Exception:
value_obj = datetime.strptime(val, '%Y-%m-%dT%H:%M:%S')
mod_hours = value_obj + timedelta(hours=DELTA_LOCALE)
val = mod_hours.strftime('%I:%M %p')
if data['type'] == 'icon':

View File

@ -4,9 +4,7 @@ import sys
import os
import logging
import base64
import platform
import time
from packaging.version import parse as parse_version
from decimal import Decimal
from datetime import datetime, timedelta, date
from collections import OrderedDict
@ -40,7 +38,6 @@ from .constants import (
SALE_FIELDS, KIND_REST, KIND_RETAIL, DIALOG_REPLY_YES,
)
from .dialogs import DialogDeliveryParty
import time
try:
from app.models import MODELS_RETAIL
except:
@ -227,7 +224,7 @@ class AppWindow(FrontWindow):
)
self.receipt_order = None
# Printing order context
if self.print_order:
if hasattr(self, 'print_order') and self.print_order:
self.receipt_order = Receipt(ctx_printing, environment=self.enviroment)
self.set_default_printer()