diff --git a/app/main.py b/app/main.py index 3f2f75d..3944609 100644 --- a/app/main.py +++ b/app/main.py @@ -150,8 +150,10 @@ class AppWindow(FrontWindow): for record in records: orders += record['orders'].values() tasks += record['tasks'].values() - print('ingresa a impresion', orders) - print('ingresa a impresion tasks', tasks) + # print('ingresa a impresion orders') + # pprint(orders) + # print('ingresa a impresion tasks') + # pprint(tasks) try: result = self.receipt_order.print_orders(orders) if result: @@ -1971,16 +1973,18 @@ class AppWindow(FrontWindow): data_station = self.Sale.method_instance('get_data_for_stations', self.sale_id) receipt = Receipt(context={}, environment='restaurant') receipt.print_tasks(data_station.values()) - result = self.receipt_order.print_orders(orders.values(), reversion) - lines_sended = result + lines_ids - print(lines_sended, 'this is lines printed') - if not reversion and lines_sended: - for line in lines: - if line['id'] in lines_sended: - line['order_sended'] = '✔' - self.model_sale_lines.update_record(line) - self.Sale.mark_commanded({'lines_ids': lines_sended}) - return result + print(orders, 'validate') + return + # result = self.receipt_order.print_orders(orders.values(), reversion) + # lines_sended = result + lines_ids + # print(lines_sended, 'this is lines printed') + # if not reversion and lines_sended: + # for line in lines: + # if line['id'] in lines_sended: + # line['order_sended'] = '✔' + # self.model_sale_lines.update_record(line) + # self.Sale.mark_commanded({'lines_ids': lines_sended}) + # return result def action_source(self): if self._state != 'checkout' and self.sources: @@ -2155,7 +2159,6 @@ class AppWindow(FrontWindow): # dom.append(['payment_method', '!=', 'all_paid']) fields = self.dialog_search_sales.fields_names - print(fields, 'this is fields') sales = self.Sale.find(dom, fields=fields, order=[('id', 'DESC')]) self.dialog_search_sales.set_from_values(sales) if self.environment == 'retail': diff --git a/app/reporting.py b/app/reporting.py index b9453e0..5fcaa7c 100755 --- a/app/reporting.py +++ b/app/reporting.py @@ -225,6 +225,7 @@ class Receipt(object): except Exception: logging.exception( "Warning: Printer error or device not found!") + logging.info(f'interface: {self._interface}, device: {self._device}') def print_sale(self, sale, type_doc=None, open_box=False): try: @@ -986,7 +987,7 @@ class Receipt(object): if line.get('id'): lines_printed.append(line['id']) except Exception: - traceback.print_exc() + logging.exception(f'Error impresion linea de orden {str(line)}') self.print_enter() self.print_enter() if isinstance(order['lines'], list): diff --git a/logger_config.py b/logger_config.py index c31d4e8..2c85381 100644 --- a/logger_config.py +++ b/logger_config.py @@ -1,8 +1,23 @@ import os import logging +if os.name == 'posix': + homex = 'HOME' + dirconfig = '.tryton' + temp_log = '/tmp' +elif os.name == 'nt': + homex = 'USERPROFILE' + dirconfig = 'AppData/Local/tryton' + temp_log = 'AppData/Local/Temp' + +HOME_DIR = os.getenv(homex) +default_dir = os.path.join(HOME_DIR, dirconfig) + +if os.path.exists(default_dir): + log_file_path = default_dir + '/presik_pos.log' +else: + log_file_path = temp_log + '/presik_pos.log' -log_file_path = os.path.dirname(os.path.abspath(__file__)) + '/presik_pos.log' log_formater = logging.Formatter( '%(asctime)s - %(levelname)s - %(funcName)s - %(name)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S', style="%") diff --git a/setup_freeze.py b/setup_freeze.py index 368a9a7..8397e5d 100644 --- a/setup_freeze.py +++ b/setup_freeze.py @@ -16,12 +16,12 @@ executables = [ options = { "build_exe": { "packages": [ + "tests", "app", "app.printing", "app.commons", "app.css", "app.locale", - "app.tests" ], "include_msvcr": True, # Incluye las bibliotecas de tiempo de ejecución de MSVC } @@ -56,6 +56,8 @@ setup( "paramiko", "orjson", "escpos", - "PySide6>=6.4.1" + "PySide6>=6.4.1", + "psutil", + "setproctitle", ] )