add product info

This commit is contained in:
wilson gomez sanchez 2021-04-12 11:29:53 -05:00
parent 7d5a8419e4
commit 99c52444f3
7 changed files with 85 additions and 8 deletions

View File

@ -139,6 +139,8 @@ class ButtonsFunction(QGridLayout):
['button_split_sale', 'DIVIDIR CUENTA', 'action_split_sale'],
]
self.values.extend(rest_options)
else:
self.values.extend([['button_product_info', 'INFO. PRODUCTO', 'action_info_product']])
class ButtonsStacked(QWidget):

View File

@ -73,9 +73,6 @@ class CustomButton(QPushButton):
if icon:
pixmap = icon.pixmap(qsize)
label_icon = QLabel()
# if id == 'button_start':
# label_icon.setObjectName('label_icon_start')
# else:
label_icon.setObjectName('label_icon')
label_icon.setPixmap(pixmap)
label_icon.setAlignment(Qt.AlignCenter | Qt.AlignCenter)

View File

@ -29,6 +29,7 @@ __all__ = [
'DialogManageTables', 'DialogHistoricSales', 'DialogSaleForm',
'DialogCancelInvoice', 'DialogForceAssign', 'CombineProduct',
'DialogReports', 'DialogFixedDiscounts', 'DialogExpenses',
'DialogInfoProduct',
]
WIZARDS = {
@ -1374,3 +1375,76 @@ class Help(HelpDialog):
]
self.set_shortcuts(shortcuts)
class DialogInfoProduct(QuickDialog):
def __init__(self, parent):
self._parent = parent
vbox = QVBoxLayout()
grid = QGridLayout()
label_code = QLabel('CODIGO:')
label_code.setObjectName('label_info_product_code')
grid.addWidget(label_code, 1, 1)
self.input_code = QLineEdit()
self.input_code.setObjectName('input_info_product_code')
self.input_code.returnPressed.connect(lambda: self.search())
grid.addWidget(self.input_code, 1, 2)
label_name = QLabel('NOMBRE:')
label_name.setObjectName('label_info_product_name')
grid.addWidget(label_name, 2, 1)
self.input_name = QLineEdit()
self.input_name.setReadOnly(True)
self.input_name.setObjectName('input_info_product_name')
grid.addWidget(self.input_name, 2, 2)
label_price = QLabel('PRECIO:')
label_price.setObjectName('label_info_product_price')
grid.addWidget(label_price, 3, 1)
self.input_price = QLineEdit()
self.input_price.setReadOnly(True)
self.input_price.setObjectName('input_info_product_price')
grid.addWidget(self.input_price, 3, 2)
label_quantity = QLabel('CANTIDAD:')
label_quantity.setObjectName('label_info_product_quantity')
grid.addWidget(label_quantity, 4, 1)
self.input_quantity = QLineEdit()
self.input_quantity.setReadOnly(True)
self.input_quantity.setObjectName('input_info_product_quantity')
grid.addWidget(self.input_quantity, 4, 2)
vbox.addLayout(grid)
super(DialogInfoProduct, self).__init__(parent, 'help', widgets=[vbox])
self.setWindowTitle('INFO. PRODUCT')
self.ok_button.setDefault(False)
width, height = get_screen()
self.setGeometry(0, 0, width * 0.4, height * 0.7)
self.input_code.setFocus()
def fill(self, values):
self.input_name.setText(values['name'])
sale_price = "{:,}".format(round(values['template']['sale_price_w_tax'], 0))
self.input_price.setText(sale_price)
self.input_quantity.setText(str(values['quantity']))
def search(self):
self.ok_button.setDefault(False)
code = self.input_code.text()
res = self.parent._search_product(code)
if res:
self.fill(res)
def show(self):
super(DialogInfoProduct, self).show()
self.input_code.setFocus()
def clear(self):
self.input_code.setText('')
self.input_name.setText('')
self.input_price.setText('')
self.input_quantity.setText('')
def dialog_accepted(self):
self.clear()
super(DialogInfoProduct, self).dialog_accepted()

View File

@ -19,7 +19,8 @@ from .dialogs import (
DialogAuthDiscounts, DeliveryPartySelected, DialogTableDeliveryParty,
DialogHistoricSales, DialogSaleForm, DialogSource, DialogReports,
DialogDeliveryParty, TipAmount, DeliveryAmount, DialogSalesmanCode,
DialogFixedDiscounts, DialogComboProduct, DialogSplitSale, DialogExpenses
DialogFixedDiscounts, DialogComboProduct, DialogSplitSale, DialogExpenses,
DialogInfoProduct
)
from .constants import DIALOG_REPLY_YES
@ -185,6 +186,7 @@ class FrontWindow(QMainWindow):
self.dialog_source = DialogSource(self)
self.dialog_split_sale = DialogSplitSale(self)
self.dialog_expenses = DialogExpenses(self)
self.dialog_info_product = DialogInfoProduct(self)
if self._commission_activated:
self.dialog_agent = DialogAgent(self)
if self.enviroment == 'restaurant' and self._sale_pos_restaurant:

View File

@ -1264,6 +1264,9 @@ class AppWindow(FrontWindow):
self.dialog_consumer.clear()
self.dialog_consumer.show()
def action_info_product(self):
self.dialog_info_product.show()
def action_print_sale(self):
number = self.field_invoice_number.text()
if not number:

View File

@ -0,0 +1 @@
<svg id="Capa_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m419.68 163.97v223.03h-371.71v-223.03l185.86-111.51z" fill="#ffa001"/><path d="m419.68 163.97v223.03h-185.85v-334.54z" fill="#f87f02"/><path d="m0 163.971 47.968-111.515h185.858l-47.968 111.515z" fill="#ffda2d"/><path d="m467.651 163.971-47.968-111.515h-185.857l47.968 111.515z" fill="#fcbe00"/><path d="m107.714 293.542h30v30h-30z" fill="#ffda2d"/><path d="m512 349.834c0 60.59-49.12 109.71-109.71 109.71-60.6 0-109.72-49.12-109.72-109.71 0-60.6 49.12-109.72 109.72-109.72 60.59 0 109.71 49.119 109.71 109.72z" fill="#83e470"/><path d="m512 349.834c0 60.59-49.12 109.71-109.71 109.71v-219.43c60.59 0 109.71 49.119 109.71 109.72z" fill="#01b763"/><path d="m459.7 332.064-57.41 57.409-9.95 9.951-47.47-47.471 21.22-21.21 26.25 26.25 9.95-9.949 36.19-36.19z" fill="#f3fdff"/><path d="m459.7 332.064-57.41 57.409v-42.429l36.19-36.19z" fill="#d7f3f7"/></g></svg>

After

Width:  |  Height:  |  Size: 1005 B

View File

@ -7,10 +7,8 @@ current_dir = os.path.dirname(__file__)
def get_icon(name):
file_icon = name if name else 'fork'
path_icon = os.path.join(current_dir, 'share', file_icon + '.svg')
_icon = QIcon(path_icon)
return _icon
path_icon = os.path.join(current_dir, 'share', name + '.svg')
return QIcon(path_icon)
def to_numeric(number):