mirror of
https://bitbucket.org/presik/presik_pos.git
synced 2023-12-14 06:03:00 +01:00
fix bugs reatil mode
This commit is contained in:
parent
d8279bb642
commit
37404591ce
4 changed files with 11 additions and 13 deletions
|
@ -222,10 +222,9 @@ class QuickDialog(QDialog):
|
||||||
|
|
||||||
def set_simple_model(self):
|
def set_simple_model(self):
|
||||||
self.data_model = QStandardItemModel(0, len(self.data['heads']), self)
|
self.data_model = QStandardItemModel(0, len(self.data['heads']), self)
|
||||||
map(self.data_model.setHeaderData, enumerate(self.data['heads'], 0))
|
_horizontal = Qt.Horizontal
|
||||||
# _horizontal = Qt.Horizontal
|
for i, h in enumerate(self.data['heads'], 0):
|
||||||
# for i, h in enumerate(self.data['heads'], 0):
|
self.data_model.setHeaderData(i, _horizontal, h)
|
||||||
# self.data_model.setHeaderData(i, _horizontal, h)
|
|
||||||
|
|
||||||
def _insert_items(self, model, values):
|
def _insert_items(self, model, values):
|
||||||
ItemIsEnabled, ItemIsSelectable = Qt.ItemIsEnabled, Qt.ItemIsSelectable
|
ItemIsEnabled, ItemIsSelectable = Qt.ItemIsEnabled, Qt.ItemIsSelectable
|
||||||
|
|
|
@ -484,7 +484,7 @@ class TableModel(QAbstractTableModel):
|
||||||
self.currentItems = self.items
|
self.currentItems = self.items
|
||||||
|
|
||||||
if searchText and self.filter_column:
|
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 = []
|
self.filteredItems = []
|
||||||
for item in self.currentItems:
|
for item in self.currentItems:
|
||||||
values = list(item.values())
|
values = list(item.values())
|
||||||
|
@ -493,7 +493,6 @@ class TableModel(QAbstractTableModel):
|
||||||
exists = all(mt in ''.join(values_clear).lower() for mt in matchers)
|
exists = all(mt in ''.join(values_clear).lower() for mt in matchers)
|
||||||
if exists:
|
if exists:
|
||||||
self.filteredItems.append(item)
|
self.filteredItems.append(item)
|
||||||
|
|
||||||
self.currentItems = self.filteredItems
|
self.currentItems = self.filteredItems
|
||||||
|
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
|
@ -243,7 +243,7 @@ class SearchSale(SearchWindow):
|
||||||
self.buttons_layout_filter.addWidget(self.pushButtonReservation)
|
self.buttons_layout_filter.addWidget(self.pushButtonReservation)
|
||||||
widgets_to_create = self.buttons_layout_filter
|
widgets_to_create = self.buttons_layout_filter
|
||||||
super(SearchSale, self).__init__(parent, headers, None, methods,
|
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])
|
title=title, fill=True, widgets=[widgets_to_create])
|
||||||
|
|
||||||
def action_search_sale(self, _type):
|
def action_search_sale(self, _type):
|
||||||
|
@ -1346,7 +1346,7 @@ class ProductEdit(QuickDialog):
|
||||||
self.show()
|
self.show()
|
||||||
name = record.get('product.template.name', None)
|
name = record.get('product.template.name', None)
|
||||||
if not name:
|
if not name:
|
||||||
name = record['product']['template']['name']
|
name = record['product.']['template.']['name']
|
||||||
self.label_product.setText(name)
|
self.label_product.setText(name)
|
||||||
if hasattr(self, 'field_description'):
|
if hasattr(self, 'field_description'):
|
||||||
self.field_description.setText(record['description'])
|
self.field_description.setText(record['description'])
|
||||||
|
|
10
app/main.py
10
app/main.py
|
@ -1916,7 +1916,7 @@ class AppWindow(FrontWindow):
|
||||||
self.field_salesman_code_ask.setText('')
|
self.field_salesman_code_ask.setText('')
|
||||||
if not salesman:
|
if not salesman:
|
||||||
return self.dialog('error_salesman_incorrect')
|
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')
|
return self.dialog('error_salesman_incorrect')
|
||||||
self.load_sale(sale_id)
|
self.load_sale(sale_id)
|
||||||
self.setFocus()
|
self.setFocus()
|
||||||
|
@ -2143,11 +2143,11 @@ class AppWindow(FrontWindow):
|
||||||
products = self.Product.find([
|
products = self.Product.find([
|
||||||
('code', '=', code),
|
('code', '=', code),
|
||||||
('template.salable', '=', True),
|
('template.salable', '=', True),
|
||||||
], fields=['template.positions.warehouse', 'template.positions.position'])
|
], fields=['template.positions.warehouse', 'template.positions.position.name'])
|
||||||
if products and products[0]['template']['positions']:
|
if products and products[0]['template.']['positions.']:
|
||||||
warehouses = {w[0]: w + [''] for w in res}
|
warehouses = {w[0]: w + [''] for w in res}
|
||||||
for p in products[0]['template']['positions']:
|
for p in products[0]['template.']['positions.']:
|
||||||
warehouses[p['warehouse']['name']][2] = p['position']['name']
|
warehouses[p['warehouse']['name']][2] = p['position.']['name']
|
||||||
res = warehouses.values()
|
res = warehouses.values()
|
||||||
self.dialog_product_stock.update_values(res)
|
self.dialog_product_stock.update_values(res)
|
||||||
self.dialog_product_stock.show()
|
self.dialog_product_stock.show()
|
||||||
|
|
Loading…
Reference in a new issue