Merge branch 'master' of bitbucket.org:presik/presik_pos
This commit is contained in:
commit
6cdcf9b834
|
@ -211,6 +211,7 @@ class SearchWindow(QDialog):
|
||||||
super(SearchWindow, self).show()
|
super(SearchWindow, self).show()
|
||||||
|
|
||||||
def hide(self):
|
def hide(self):
|
||||||
|
self.clear_filter()
|
||||||
self.parent.setFocus()
|
self.parent.setFocus()
|
||||||
super(SearchWindow, self).hide()
|
super(SearchWindow, self).hide()
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ __all__ = [
|
||||||
'DialogManageTables', 'DialogHistoricSales', 'DialogSaleForm',
|
'DialogManageTables', 'DialogHistoricSales', 'DialogSaleForm',
|
||||||
'DialogCancelInvoice', 'DialogForceAssign', 'CombineProduct',
|
'DialogCancelInvoice', 'DialogForceAssign', 'CombineProduct',
|
||||||
'DialogReports', 'DialogFixedDiscounts', 'DialogExpenses',
|
'DialogReports', 'DialogFixedDiscounts', 'DialogExpenses',
|
||||||
'DialogInfoProduct',
|
'DialogInfoProduct', 'SearchProductInfo'
|
||||||
]
|
]
|
||||||
|
|
||||||
WIZARDS = {
|
WIZARDS = {
|
||||||
|
@ -284,6 +284,58 @@ class SearchProduct(SearchWindow):
|
||||||
cols_width=_cols_width, fill=True)
|
cols_width=_cols_width, fill=True)
|
||||||
|
|
||||||
|
|
||||||
|
class SearchProductInfo(SearchWindow):
|
||||||
|
def __init__(self, parent):
|
||||||
|
_cols_width = [10, 80]
|
||||||
|
headers = OrderedDict()
|
||||||
|
headers['id'] = {'desc': ('ID'), 'type': 'char'}
|
||||||
|
headers['code'] = {'desc': ('COD'), 'type': 'char'}
|
||||||
|
if parent._config.get('show_stock_pos') in ['icon', 'value']:
|
||||||
|
headers['quantity'] = {'desc': ('STOCK'), 'type': 'char'}
|
||||||
|
_cols_width.append(60)
|
||||||
|
|
||||||
|
if not parent.cache_local:
|
||||||
|
headers['name'] = {'desc': 'NOMBRE', 'type': 'char'}
|
||||||
|
else:
|
||||||
|
headers['template.name'] = {'desc': 'NOMBRE', 'type': 'char'}
|
||||||
|
|
||||||
|
_cols_width.append(350)
|
||||||
|
|
||||||
|
if parent._config.get('show_description_pos'):
|
||||||
|
headers['description'] = {'desc': 'DESCRIPCION', 'type': 'char'}
|
||||||
|
_cols_width.append(300)
|
||||||
|
|
||||||
|
if parent._config.get('show_brand'):
|
||||||
|
headers['template.brand'] = {'desc': 'BRAND', 'type': 'char'}
|
||||||
|
_cols_width.append(100)
|
||||||
|
|
||||||
|
price = {'desc': ('PRICE'), 'type': 'number'}
|
||||||
|
if not parent._config.get('encoded_sale_price'):
|
||||||
|
headers['template.sale_price_w_tax'] = price
|
||||||
|
else:
|
||||||
|
price['type'] = 'char'
|
||||||
|
headers['encoded_sale_price'] = price
|
||||||
|
|
||||||
|
_cols_width.append(100)
|
||||||
|
|
||||||
|
if parent._config.get('show_location_pos'):
|
||||||
|
headers['location.name'] = {'desc': 'BODEGA', 'type': 'char'}
|
||||||
|
_cols_width.append(100)
|
||||||
|
|
||||||
|
methods = {
|
||||||
|
'on_selected_method': 'on_selected_product_info',
|
||||||
|
'on_return_method': 'on_search_product',
|
||||||
|
}
|
||||||
|
fields_names = list(headers.keys())
|
||||||
|
try:
|
||||||
|
fields_names.remove('image')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self.fields_names = fields_names
|
||||||
|
super(SearchProductInfo, self).__init__(parent, headers, None, methods,
|
||||||
|
cols_width=_cols_width, fill=True)
|
||||||
|
|
||||||
|
|
||||||
class DialogManageTables(QuickDialog):
|
class DialogManageTables(QuickDialog):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
@ -1377,6 +1429,20 @@ class Help(HelpDialog):
|
||||||
self.set_shortcuts(shortcuts)
|
self.set_shortcuts(shortcuts)
|
||||||
|
|
||||||
|
|
||||||
|
class DialogListProduct(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)
|
||||||
|
|
||||||
|
|
||||||
class DialogInfoProduct(QuickDialog):
|
class DialogInfoProduct(QuickDialog):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
self._parent = parent
|
self._parent = parent
|
||||||
|
@ -1394,8 +1460,9 @@ class DialogInfoProduct(QuickDialog):
|
||||||
label_name.setObjectName('label_info_product_name')
|
label_name.setObjectName('label_info_product_name')
|
||||||
grid.addWidget(label_name, 2, 1)
|
grid.addWidget(label_name, 2, 1)
|
||||||
self.input_name = QLineEdit()
|
self.input_name = QLineEdit()
|
||||||
self.input_name.setReadOnly(True)
|
# self.input_name.setReadOnly(True)
|
||||||
self.input_name.setObjectName('input_info_product_name')
|
self.input_name.setObjectName('input_info_product_name')
|
||||||
|
self.input_name.returnPressed.connect(lambda: self.search())
|
||||||
grid.addWidget(self.input_name, 2, 2)
|
grid.addWidget(self.input_name, 2, 2)
|
||||||
|
|
||||||
label_price = QLabel('PRECIO:')
|
label_price = QLabel('PRECIO:')
|
||||||
|
@ -1423,16 +1490,18 @@ class DialogInfoProduct(QuickDialog):
|
||||||
self.input_code.setFocus()
|
self.input_code.setFocus()
|
||||||
|
|
||||||
def fill(self, values):
|
def fill(self, values):
|
||||||
|
self.input_code.setText(values['code'])
|
||||||
self.input_name.setText(values['name'])
|
self.input_name.setText(values['name'])
|
||||||
sale_price = "{:,}".format(round(values['template']['sale_price_w_tax']+values['extra_tax'], 0))
|
sale_price = "{:,}".format(round(values['template']['sale_price_w_tax']+values['extra_tax'], 0))
|
||||||
self.input_price.setText(sale_price)
|
self.input_price.setText(sale_price)
|
||||||
self.input_quantity.setText(str(values['quantity']))
|
self.input_quantity.setText(str(values['quantity']))
|
||||||
|
|
||||||
def search(self):
|
def search(self, values=None):
|
||||||
self.ok_button.setDefault(False)
|
self.ok_button.setDefault(False)
|
||||||
code = self.input_code.text()
|
code = self.input_code.text()
|
||||||
|
if values:
|
||||||
|
code = values['code']
|
||||||
res = self.parent._search_product(code)
|
res = self.parent._search_product(code)
|
||||||
print(res)
|
|
||||||
if res:
|
if res:
|
||||||
self.fill(res)
|
self.fill(res)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ from .dialogs import (
|
||||||
DialogHistoricSales, DialogSaleForm, DialogSource, DialogReports,
|
DialogHistoricSales, DialogSaleForm, DialogSource, DialogReports,
|
||||||
DialogDeliveryParty, TipAmount, DeliveryAmount, DialogSalesmanCode,
|
DialogDeliveryParty, TipAmount, DeliveryAmount, DialogSalesmanCode,
|
||||||
DialogFixedDiscounts, DialogComboProduct, DialogSplitSale, DialogExpenses,
|
DialogFixedDiscounts, DialogComboProduct, DialogSplitSale, DialogExpenses,
|
||||||
DialogInfoProduct
|
DialogInfoProduct, SearchProductInfo
|
||||||
)
|
)
|
||||||
from .constants import DIALOG_REPLY_YES
|
from .constants import DIALOG_REPLY_YES
|
||||||
|
|
||||||
|
@ -190,6 +190,7 @@ class FrontWindow(QMainWindow):
|
||||||
self.dialog_split_sale = DialogSplitSale(self)
|
self.dialog_split_sale = DialogSplitSale(self)
|
||||||
self.dialog_expenses = DialogExpenses(self)
|
self.dialog_expenses = DialogExpenses(self)
|
||||||
self.dialog_info_product = DialogInfoProduct(self)
|
self.dialog_info_product = DialogInfoProduct(self)
|
||||||
|
self.dialog_search_product_info = SearchProductInfo(self)
|
||||||
if self._commission_activated:
|
if self._commission_activated:
|
||||||
self.dialog_agent = DialogAgent(self)
|
self.dialog_agent = DialogAgent(self)
|
||||||
if self.enviroment == 'restaurant' and self._sale_pos_restaurant:
|
if self.enviroment == 'restaurant' and self._sale_pos_restaurant:
|
||||||
|
|
17
app/main.py
17
app/main.py
|
@ -1275,7 +1275,7 @@ class AppWindow(FrontWindow):
|
||||||
self.dialog_consumer.show()
|
self.dialog_consumer.show()
|
||||||
|
|
||||||
def action_info_product(self):
|
def action_info_product(self):
|
||||||
self.dialog_info_product.show()
|
self.dialog_search_product_info.show()
|
||||||
|
|
||||||
def action_print_sale(self):
|
def action_print_sale(self):
|
||||||
number = self.field_invoice_number.text()
|
number = self.field_invoice_number.text()
|
||||||
|
@ -1863,6 +1863,13 @@ class AppWindow(FrontWindow):
|
||||||
self._current_line_id = None
|
self._current_line_id = None
|
||||||
self.add_product(record=self.dialog_search_products.current_row)
|
self.add_product(record=self.dialog_search_products.current_row)
|
||||||
|
|
||||||
|
def on_selected_product_info(self):
|
||||||
|
if self.dialog_search_product_info.current_row:
|
||||||
|
self._current_line_id = None
|
||||||
|
record = self.dialog_search_product_info.current_row
|
||||||
|
self.dialog_info_product.search(record)
|
||||||
|
self.dialog_info_product.show()
|
||||||
|
|
||||||
def on_selected_icon_product(self):
|
def on_selected_icon_product(self):
|
||||||
if self.dialog_search_products.current_row:
|
if self.dialog_search_products.current_row:
|
||||||
code = self.dialog_search_products.current_row['code']
|
code = self.dialog_search_products.current_row['code']
|
||||||
|
@ -1975,6 +1982,9 @@ class AppWindow(FrontWindow):
|
||||||
|
|
||||||
def on_search_product(self):
|
def on_search_product(self):
|
||||||
target = self.dialog_search_products.filter_field.text()
|
target = self.dialog_search_products.filter_field.text()
|
||||||
|
target2 = self.dialog_search_product_info.filter_field.text()
|
||||||
|
if target2:
|
||||||
|
target = target2
|
||||||
if not target:
|
if not target:
|
||||||
return
|
return
|
||||||
target_words = target.split(' ')
|
target_words = target.split(' ')
|
||||||
|
@ -2010,6 +2020,7 @@ class AppWindow(FrontWindow):
|
||||||
limit=100, ctx=self.stock_context)
|
limit=100, ctx=self.stock_context)
|
||||||
|
|
||||||
self.dialog_search_products.set_from_values(products)
|
self.dialog_search_products.set_from_values(products)
|
||||||
|
self.dialog_search_product_info.set_from_values(products)
|
||||||
|
|
||||||
def on_search_party(self):
|
def on_search_party(self):
|
||||||
target = self.dialog_search_parties.filter_field.text()
|
target = self.dialog_search_parties.filter_field.text()
|
||||||
|
@ -2188,6 +2199,7 @@ class AppWindow(FrontWindow):
|
||||||
('barcode', '=', code),
|
('barcode', '=', code),
|
||||||
('code', '=', code)
|
('code', '=', code)
|
||||||
])
|
])
|
||||||
|
|
||||||
if self.cache_local:
|
if self.cache_local:
|
||||||
clause = [
|
clause = [
|
||||||
'OR',
|
'OR',
|
||||||
|
@ -2207,8 +2219,7 @@ class AppWindow(FrontWindow):
|
||||||
if not products or len(products) > 1:
|
if not products or len(products) > 1:
|
||||||
self.message_bar.set('product_not_found')
|
self.message_bar.set('product_not_found')
|
||||||
return False
|
return False
|
||||||
else:
|
product = products[0]
|
||||||
product = products[0]
|
|
||||||
return product
|
return product
|
||||||
|
|
||||||
def _check_quantity(self):
|
def _check_quantity(self):
|
||||||
|
|
Loading…
Reference in New Issue