Fix search window
This commit is contained in:
parent
e9d910c23a
commit
62b99dd9b1
|
@ -0,0 +1,27 @@
|
|||
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/build
|
||||
/dist
|
||||
*egg-info
|
||||
|
||||
|
||||
/node_modules
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
|
||||
.DS_Store
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
package-lock*
|
||||
|
||||
/__pycache__
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -138,7 +138,6 @@ class MainWindow(FrontWindow):
|
|||
config = self.store.get_config()
|
||||
_sync_date = config[1]
|
||||
products = self.Product.sync_get_products({'write_date': _sync_date, 'shop_id': self.ctx['shop']})
|
||||
# print('products------->', products)
|
||||
self.store.update_products(products, local_products)
|
||||
now = datetime.now()
|
||||
self.store.set_config_sync(str(now))
|
||||
|
@ -146,7 +145,6 @@ class MainWindow(FrontWindow):
|
|||
def event(self, evento):
|
||||
event_type = super(MainWindow, self).event(evento)
|
||||
touch = QTouchEvent(event_type)
|
||||
# logging.warning('Device:', touch.device())
|
||||
return event_type
|
||||
|
||||
def set_printers_usb(self, PATH_PRINTERS):
|
||||
|
@ -1271,7 +1269,7 @@ class MainWindow(FrontWindow):
|
|||
res = self.dialog_order.exec_()
|
||||
if res == DIALOG_REPLY_NO:
|
||||
return
|
||||
# order_number = self.field_order_ask.text()
|
||||
|
||||
kind = 'delivery'
|
||||
if self.enviroment == 'restaurant':
|
||||
kind = 'command'
|
||||
|
@ -1526,8 +1524,6 @@ class MainWindow(FrontWindow):
|
|||
|
||||
def update_total_amount(self):
|
||||
self.set_amounts()
|
||||
# res = self.model_sale_lines.get_sum('amount_w_tax')
|
||||
# self.field_total_amount.setText(res)
|
||||
|
||||
def set_amounts(self, res=None):
|
||||
if not res:
|
||||
|
@ -1547,7 +1543,8 @@ class MainWindow(FrontWindow):
|
|||
])
|
||||
return [
|
||||
[r['id'], r['code'], r['template.name'], r['template.sale_price_w_tax']]
|
||||
for r in records]
|
||||
for r in records
|
||||
]
|
||||
|
||||
def get_product_by_categories(self):
|
||||
domain = [
|
||||
|
@ -1651,19 +1648,17 @@ class MainWindow(FrontWindow):
|
|||
self.dialog_manage_tables = QuickDialog(self, 'action', widgets=[self.tables])
|
||||
|
||||
def create_dialog_search_sales(self):
|
||||
headers = [
|
||||
('id', self.tr('ID')),
|
||||
('number', self.tr('NUMBER')),
|
||||
('invoice_number', self.tr('INVOICE')),
|
||||
('sale_date', self.tr('DATE')),
|
||||
('salesman.party.name', self.tr('SALESMAN')),
|
||||
('position', self.tr('POSITION')),
|
||||
('total_amount_cache', self.tr('TOTAL AMOUNT')),
|
||||
]
|
||||
widths = [20, 100, 100, 90, 150, 100, 100]
|
||||
if self.enviroment == 'retail':
|
||||
headers.insert(2, ('party.name', self.tr('PARTY')))
|
||||
widths.insert(2, 150)
|
||||
headers = OrderedDict()
|
||||
headers['id'] = {'desc': self.tr('ID'), 'type': 'char'}
|
||||
headers['number'] = {'desc': self.tr('NUMBER'), 'type': 'char'}
|
||||
headers['invoice_number'] = {'desc': self.tr('INVOICE'), 'type': 'char'}
|
||||
headers['party.name'] = {'desc': self.tr('PARTY'), 'type': 'char'}
|
||||
headers['sale_date'] = {'desc': self.tr('DATE'), 'type': 'date'}
|
||||
headers['salesman.party.name'] = {'desc': self.tr('SALESMAN'), 'type': 'char'}
|
||||
headers['position'] = {'desc': self.tr('POSITION'), 'type': 'char'}
|
||||
headers['total_amount_cache'] = {'desc': self.tr('TOTAL AMOUNT'), 'type': 'number'}
|
||||
|
||||
widths = [20, 100, 150, 100, 90, 150, 100, 100]
|
||||
title = self.tr('SEARCH SALES...')
|
||||
methods = {
|
||||
'on_selected_method': 'on_selected_sale',
|
||||
|
@ -1676,49 +1671,48 @@ class MainWindow(FrontWindow):
|
|||
|
||||
def create_dialog_search_products(self):
|
||||
_cols_width = [10, 80]
|
||||
headers = [
|
||||
('id', self.tr('ID')),
|
||||
('code', self.tr('CODE')),
|
||||
]
|
||||
if self._config.get('show_stock_pos') in ['icon', 'value']:
|
||||
if self._config['show_stock_pos'] == 'icon':
|
||||
headers.append(('icon_stock', self.tr('STOCK')))
|
||||
else:
|
||||
headers.append(('quantity', self.tr('STOCK')))
|
||||
_cols_width.append(80)
|
||||
headers = OrderedDict()
|
||||
headers['id'] = {'desc': self.tr('ID'), 'type': 'char'}
|
||||
headers['code'] = {'desc': self.tr('CODE'), 'type': 'char'}
|
||||
|
||||
headers.append(
|
||||
('template.name', self.tr('NAME')),
|
||||
)
|
||||
if self._config.get('show_stock_pos') in ['icon', 'value']:
|
||||
headers['quantity'] = {'desc': self.tr('STOCK'), 'type': 'number'}
|
||||
if self._config['show_stock_pos'] == 'icon':
|
||||
headers['quantity']['icon'] = 'stock'
|
||||
headers['quantity']['type'] = 'icon'
|
||||
_cols_width.append(60)
|
||||
|
||||
headers['name'] = {'desc': self.tr('NAME'), 'type': 'char'}
|
||||
_cols_width.append(350)
|
||||
|
||||
if self._config.get('show_description_pos'):
|
||||
headers.append(('description', self.tr('DESCRIPTION')))
|
||||
headers['description'] = {'desc': self.tr('DESCRIPTION'), 'type': 'char'}
|
||||
_cols_width.append(300)
|
||||
|
||||
if self._config.get('show_brand'):
|
||||
headers.append(('brand.name', self.tr('BRAND')))
|
||||
headers['brand'] = {'desc': self.tr('BRAND'), 'type': 'char'}
|
||||
_cols_width.append(100)
|
||||
|
||||
price = {'desc': self.tr('PRICE'), 'type': 'number'}
|
||||
if not self._config.get('encoded_sale_price'):
|
||||
sale_price = ('template.sale_price_w_tax', self.tr('PRICE'))
|
||||
headers['template.sale_price_w_tax'] = price
|
||||
else:
|
||||
sale_price = ('encoded_sale_price', self.tr('PRICE'))
|
||||
headers.append(sale_price)
|
||||
_cols_width.append(90)
|
||||
headers['encoded_sale_price'] = price
|
||||
|
||||
_cols_width.append(100)
|
||||
|
||||
if self._config.get('show_location_pos'):
|
||||
headers.append(('location.name', self.tr('LOCATION')))
|
||||
headers['location.name'] = {'desc': self.tr('LOCATION'), 'type': 'char'}
|
||||
_cols_width.append(100)
|
||||
|
||||
if self._config['show_product_image']:
|
||||
headers.append(('icon_camera', self.tr('IMAGE')))
|
||||
headers['image'] = {'desc': self.tr('IMAGE'), 'icon': 'image', 'type': 'icon'}
|
||||
_cols_width.append(30)
|
||||
|
||||
methods = {
|
||||
'on_selected_method': 'on_selected_product',
|
||||
'on_return_method': 'on_search_product',
|
||||
'icon_camera': self.on_selected_icon_product,
|
||||
'icon_stock': self.on_selected_stock_product,
|
||||
'image': self.on_selected_icon_product,
|
||||
'quantity': self.on_selected_stock_product
|
||||
}
|
||||
|
||||
|
@ -1726,13 +1720,13 @@ class MainWindow(FrontWindow):
|
|||
methods, cols_width=_cols_width, fill=True)
|
||||
|
||||
def create_dialog_search_party(self):
|
||||
headers = [
|
||||
('id', self.tr('ID')),
|
||||
('id_number', self.tr('ID NUMBER')),
|
||||
('name', self.tr('NAME')),
|
||||
('street', self.tr('ADDRESS')),
|
||||
('phone', self.tr('PHONE')),
|
||||
]
|
||||
headers = OrderedDict()
|
||||
headers['id'] = {'desc': self.tr('ID'), 'type': 'char'}
|
||||
headers['id_number'] = {'desc': self.tr('ID NUMBER'), 'type': 'char'}
|
||||
headers['name'] = {'desc': self.tr('NAME'), 'type': 'char'}
|
||||
headers['street'] = {'desc': self.tr('ADDRESS'), 'type': 'char'}
|
||||
headers['phone'] = {'desc': self.tr('PHONE'), 'type': 'char'}
|
||||
|
||||
title = self.tr('SEARCH CUSTOMER')
|
||||
methods = {
|
||||
'on_selected_method': 'on_selected_party',
|
||||
|
@ -1763,7 +1757,6 @@ class MainWindow(FrontWindow):
|
|||
'selection', label, data, readonly=True)
|
||||
|
||||
def create_dialog_salesman(self):
|
||||
print(self.employees)
|
||||
data = {
|
||||
'name': 'salesman',
|
||||
'values': [(str(e['id']), e['party']['name'])
|
||||
|
@ -1818,6 +1811,7 @@ class MainWindow(FrontWindow):
|
|||
products = self.store.find_product_elastic(domain, limit=100)
|
||||
else:
|
||||
products = self.Product.find(domain, limit=100, ctx=self.stock_context)
|
||||
|
||||
self.dialog_search_products.set_from_values(products)
|
||||
|
||||
def on_search_party(self):
|
||||
|
|
Loading…
Reference in New Issue