fix bugs reatil mode

This commit is contained in:
Wilson Gomez 2023-02-02 17:29:33 -05:00
parent d8279bb642
commit 37404591ce
4 changed files with 11 additions and 13 deletions

View File

@ -222,10 +222,9 @@ class QuickDialog(QDialog):
def set_simple_model(self):
self.data_model = QStandardItemModel(0, len(self.data['heads']), self)
map(self.data_model.setHeaderData, enumerate(self.data['heads'], 0))
# _horizontal = Qt.Horizontal
# for i, h in enumerate(self.data['heads'], 0):
# self.data_model.setHeaderData(i, _horizontal, h)
_horizontal = Qt.Horizontal
for i, h in enumerate(self.data['heads'], 0):
self.data_model.setHeaderData(i, _horizontal, h)
def _insert_items(self, model, values):
ItemIsEnabled, ItemIsSelectable = Qt.ItemIsEnabled, Qt.ItemIsSelectable

View File

@ -484,7 +484,7 @@ class TableModel(QAbstractTableModel):
self.currentItems = self.items
if searchText and self.filter_column:
matchers = (t.lower() for t in searchText.split(' '))
matchers = tuple(t.lower() for t in searchText.split(' '))
self.filteredItems = []
for item in self.currentItems:
values = list(item.values())
@ -493,7 +493,6 @@ class TableModel(QAbstractTableModel):
exists = all(mt in ''.join(values_clear).lower() for mt in matchers)
if exists:
self.filteredItems.append(item)
self.currentItems = self.filteredItems
self.layoutChanged.emit()

View File

@ -243,7 +243,7 @@ class SearchSale(SearchWindow):
self.buttons_layout_filter.addWidget(self.pushButtonReservation)
widgets_to_create = self.buttons_layout_filter
super(SearchSale, self).__init__(parent, headers, None, methods,
filter_column=(2, 3, 4, 5, 6, 7), cols_width=widths,
filter_column=(1, 2, 3, 4, 5, 6, 7), cols_width=widths,
title=title, fill=True, widgets=[widgets_to_create])
def action_search_sale(self, _type):
@ -1346,7 +1346,7 @@ class ProductEdit(QuickDialog):
self.show()
name = record.get('product.template.name', None)
if not name:
name = record['product']['template']['name']
name = record['product.']['template.']['name']
self.label_product.setText(name)
if hasattr(self, 'field_description'):
self.field_description.setText(record['description'])

View File

@ -1916,7 +1916,7 @@ class AppWindow(FrontWindow):
self.field_salesman_code_ask.setText('')
if not salesman:
return self.dialog('error_salesman_incorrect')
elif salesman['code'] != sale[0]['salesman']['code']:
elif salesman['code'] != sale[0]['salesman.']['code']:
return self.dialog('error_salesman_incorrect')
self.load_sale(sale_id)
self.setFocus()
@ -2143,11 +2143,11 @@ class AppWindow(FrontWindow):
products = self.Product.find([
('code', '=', code),
('template.salable', '=', True),
], fields=['template.positions.warehouse', 'template.positions.position'])
if products and products[0]['template']['positions']:
], fields=['template.positions.warehouse', 'template.positions.position.name'])
if products and products[0]['template.']['positions.']:
warehouses = {w[0]: w + [''] for w in res}
for p in products[0]['template']['positions']:
warehouses[p['warehouse']['name']][2] = p['position']['name']
for p in products[0]['template.']['positions.']:
warehouses[p['warehouse']['name']][2] = p['position.']['name']
res = warehouses.values()
self.dialog_product_stock.update_values(res)
self.dialog_product_stock.show()