diff --git a/app/buttonpad.py b/app/buttonpad.py index 222e64e..fa3abf2 100644 --- a/app/buttonpad.py +++ b/app/buttonpad.py @@ -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): diff --git a/app/commons/custom_button.py b/app/commons/custom_button.py index ca32424..3c0e275 100644 --- a/app/commons/custom_button.py +++ b/app/commons/custom_button.py @@ -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) diff --git a/app/dialogs.py b/app/dialogs.py index 6368af8..ab395bc 100644 --- a/app/dialogs.py +++ b/app/dialogs.py @@ -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() diff --git a/app/frontwindow.py b/app/frontwindow.py index 0b47f97..be82ce8 100644 --- a/app/frontwindow.py +++ b/app/frontwindow.py @@ -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: diff --git a/app/main.py b/app/main.py index 02d145f..c5f004f 100644 --- a/app/main.py +++ b/app/main.py @@ -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: diff --git a/app/share/product_info.svg b/app/share/product_info.svg new file mode 100644 index 0000000..993f1bf --- /dev/null +++ b/app/share/product_info.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/tools.py b/app/tools.py index 5188b63..f86f7db 100644 --- a/app/tools.py +++ b/app/tools.py @@ -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):