Change pediente by cambio
This commit is contained in:
parent
f38f24990f
commit
a28d3149eb
|
@ -97,7 +97,6 @@ class Label(QLabel):
|
|||
def __init__(self, obj, key, value, align='right', form=None):
|
||||
super(Label, self).__init__()
|
||||
self.key = key
|
||||
self.form = form
|
||||
self.setText(value['name'] + ':')
|
||||
set_object_name(self, 'label_', value)
|
||||
if align == 'left':
|
||||
|
@ -435,6 +434,7 @@ class GridForm(QGridLayout):
|
|||
|
||||
if not value.get('placeholder'):
|
||||
_label = Label(obj, key, value, align, form=self)
|
||||
setattr(self, 'label_' + key, _label)
|
||||
|
||||
self.setRowStretch(row, 0)
|
||||
column1 = cols * col + 1 + expand
|
||||
|
|
34
app/main.py
34
app/main.py
|
@ -8,7 +8,7 @@ from decimal import Decimal
|
|||
from datetime import datetime, timedelta, date
|
||||
from collections import OrderedDict
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import (QLabel, QHBoxLayout, QVBoxLayout, QWidget, QAbstractItemView)
|
||||
from PyQt5.QtWidgets import (QLabel, QHBoxLayout, QVBoxLayout, QWidget)
|
||||
|
||||
from .frontwindow import FrontWindow
|
||||
from .tools import get_icon, to_float, to_numeric
|
||||
|
@ -541,16 +541,8 @@ class AppWindow(FrontWindow):
|
|||
'size': self.screen_size,
|
||||
'color': self.label_color,
|
||||
}),
|
||||
('residual_amount', {
|
||||
'name': 'PENDIENTE',
|
||||
'readonly': True,
|
||||
'type': 'money',
|
||||
'size': self.screen_size,
|
||||
'color': self.label_color_2 or 'blue',
|
||||
'invisible': invisible,
|
||||
}),
|
||||
('change', {
|
||||
'name': 'CAMBIO',
|
||||
'name': 'PENDIENTE',
|
||||
'readonly': True,
|
||||
'type': 'money',
|
||||
'size': self.screen_size,
|
||||
|
@ -794,6 +786,7 @@ class AppWindow(FrontWindow):
|
|||
return False
|
||||
|
||||
if res['residual_amount'] <= 0:
|
||||
self.grid_amounts.label_change.setText('CAMBIO')
|
||||
self._done_sale()
|
||||
return True
|
||||
|
||||
|
@ -814,9 +807,13 @@ class AppWindow(FrontWindow):
|
|||
'residual_amount': residual_amount,
|
||||
'change': res['change'],
|
||||
})
|
||||
if residual_amount <= 0:
|
||||
self._done_sale()
|
||||
return True
|
||||
|
||||
print('change.... ', res['change'])
|
||||
print('XXXXXXXXX ', self.grid_amounts.label_change.text())
|
||||
# if residual_amount <= 0:
|
||||
# self.grid_amounts.label_change.setText('CAMBIO')
|
||||
# self._done_sale()
|
||||
# return True
|
||||
|
||||
def validate_done_sale(self):
|
||||
if self.model_sale_lines.rowCount() == 0:
|
||||
|
@ -959,7 +956,6 @@ class AppWindow(FrontWindow):
|
|||
all_commmanded = self.check_all_commanded()
|
||||
if not all_commmanded:
|
||||
self.action_send_order(init_view=False)
|
||||
# time.sleep(2)
|
||||
|
||||
def button_accept_pressed(self):
|
||||
kind = self.store.get('kind')
|
||||
|
@ -1470,7 +1466,7 @@ class AppWindow(FrontWindow):
|
|||
|
||||
result = self._print_order(sale_id, kind)
|
||||
if result:
|
||||
self.dialog('order_successfully', widgets=[self.order_number, ])
|
||||
self.dialog('order_successfully', widgets=[self.order_number])
|
||||
else:
|
||||
self.dialog('order_failed')
|
||||
if self.enviroment == 'restaurant':
|
||||
|
@ -1844,9 +1840,9 @@ class AppWindow(FrontWindow):
|
|||
_text = ''
|
||||
current_note = line['note']
|
||||
if current_note:
|
||||
_text = current_note + ' | '
|
||||
_text = current_note + ' \n'
|
||||
else:
|
||||
_text = '==> COMBO CON '
|
||||
_text = 'CON '
|
||||
new_note = _text + record['template']['rec_name']
|
||||
self.dialog_product_edit.field_note.setText(new_note)
|
||||
self.dialog_product_edit.active_line['note'] = new_note
|
||||
|
@ -1863,7 +1859,7 @@ class AppWindow(FrontWindow):
|
|||
current_note = line['note']
|
||||
if current_note:
|
||||
_text = current_note + ' | '
|
||||
new_note = _text + '==> COMBINA CON ' + record['template']['rec_name']
|
||||
new_note = _text + 'COMB. CON ' + record['template']['rec_name']
|
||||
self.dialog_product_edit.field_note.setText(new_note)
|
||||
self.SaleLine.write([line['id']], {'note': new_note})
|
||||
|
||||
|
@ -2034,7 +2030,6 @@ class AppWindow(FrontWindow):
|
|||
self.field_change.zero()
|
||||
self.field_paid_amount.zero()
|
||||
self.field_discount.zero()
|
||||
self.field_residual_amount.zero()
|
||||
self.table_payment_lines.reset()
|
||||
if self.enviroment == 'restaurant':
|
||||
self.field_tip_amount.setText('')
|
||||
|
@ -2195,6 +2190,7 @@ class AppWindow(FrontWindow):
|
|||
if self._clear_invoice_number:
|
||||
self.field_invoice_number.setText('')
|
||||
self._clear_invoice_number = False
|
||||
self.grid_amounts.label_change.setText('PENDIENTE')
|
||||
|
||||
product_id = None
|
||||
if record:
|
||||
|
|
|
@ -10,19 +10,19 @@ from .printing.protocols import FileSSH
|
|||
|
||||
try:
|
||||
from escpos import printer
|
||||
except:
|
||||
logging.warning("Escpos module not found!")
|
||||
except ImportError as error:
|
||||
logging.warning(f"Error importing ! {error}")
|
||||
|
||||
pyudev = None
|
||||
try:
|
||||
import pyudev
|
||||
except:
|
||||
logging.warning("Pyudev module not found!")
|
||||
except ImportError as error:
|
||||
logging.warning(f"Error importing ! {error}")
|
||||
|
||||
try:
|
||||
import cups
|
||||
except:
|
||||
logging.warning("Cups module not found!")
|
||||
except ImportError as error:
|
||||
logging.warning(f"Error importing ! {error}")
|
||||
|
||||
__all__ = ['Receipt']
|
||||
|
||||
|
@ -162,7 +162,7 @@ class Receipt(object):
|
|||
self._profile = printer['profile']
|
||||
|
||||
def set_printer(self):
|
||||
if 1: #try:
|
||||
try:
|
||||
if self._interface == 'usb':
|
||||
if os.name == 'posix':
|
||||
self._printer = printer.File(self._device, profile=self._profile)
|
||||
|
@ -182,7 +182,7 @@ class Receipt(object):
|
|||
self.logger.info("Warning: Can not found Printer!")
|
||||
return
|
||||
self.logger.info("Info: Printer is OK!")
|
||||
else: #except:
|
||||
except:
|
||||
self.logger.info("Warning: Printer error or device not found!")
|
||||
|
||||
def print_sale(self, sale, type_doc=None, open_box=False):
|
||||
|
@ -800,6 +800,7 @@ class Receipt(object):
|
|||
col_width_name = self.order_col_2 + self.order_col_3
|
||||
|
||||
self._printer.set(align='left')
|
||||
self._printer.set(custom_size=True, width=1, height=2)
|
||||
self.print_horinzontal_double_line()
|
||||
|
||||
self.print_enter()
|
||||
|
@ -809,12 +810,11 @@ class Receipt(object):
|
|||
qty = ' ' + str(int(Decimal(line['quantity'])))
|
||||
self.print_col(qty, self.order_col_1)
|
||||
self.print_col(line['name'], col_width_name)
|
||||
# self._printer.set(custom_size=False)
|
||||
# self.print_col(' ' + str(line['unit_price']), self.order_col_3)
|
||||
if line['note']:
|
||||
self.print_enter()
|
||||
self._printer.text('--->> NOTA: ' + line['note'])
|
||||
self.print_enter()
|
||||
for msg_note in line['note'].split('\n'):
|
||||
self._printer.text(f' NOTA -> {msg_note}')
|
||||
self.print_enter()
|
||||
self.print_enter()
|
||||
|
||||
self.print_enter()
|
||||
|
|
Loading…
Reference in New Issue