- fix dialog SearchWindow in get attribute child
when attribute parent is None - comment option get products cache local
This commit is contained in:
parent
13d50c0e52
commit
7ef2acb08e
|
@ -365,7 +365,8 @@ class TableModel(QAbstractTableModel):
|
|||
try:
|
||||
val = val[attr + '.']
|
||||
except Exception:
|
||||
val = val[attr]
|
||||
if val:
|
||||
val = val[attr]
|
||||
# val = values.get(attrs[0] + '.')
|
||||
# if val:
|
||||
# val = val.get(attrs[1])
|
||||
|
|
|
@ -305,10 +305,10 @@ class SearchProduct(SearchWindow):
|
|||
headers['quantity']['type'] = 'icon'
|
||||
_cols_width_append(60)
|
||||
|
||||
if not parent.cache_local:
|
||||
headers['name'] = {'desc': 'NOMBRE', 'type': 'char'}
|
||||
else:
|
||||
headers['template.name'] = {'desc': 'NOMBRE', 'type': 'char'}
|
||||
# if not parent.cache_local:
|
||||
# headers['name'] = {'desc': 'NOMBRE', 'type': 'char'}
|
||||
# else:
|
||||
headers['template.name'] = {'desc': 'NOMBRE', 'type': 'char'}
|
||||
|
||||
_cols_width_append(350)
|
||||
|
||||
|
@ -1710,22 +1710,22 @@ class DialogInfoProduct(QuickDialog):
|
|||
('name', 'ilike', '%' + filter + '%')
|
||||
])
|
||||
|
||||
if self._parent.cache_local:
|
||||
clause = [
|
||||
'OR',
|
||||
('barcode', 'ilike', '%{:}%'.format(filter)),
|
||||
('code', 'ilike', '%{:}%'.format(filter)),
|
||||
('code', 'ilike', '%{:}%'.format(filter)),
|
||||
]
|
||||
domain = [clause]
|
||||
products = self._parent.local_db.find_product_elastic(domain, limit=100)
|
||||
else:
|
||||
products = self._parent.Product.find(domain, ctx=self._parent.stock_context,
|
||||
fields=['name', 'code', 'description',
|
||||
'id', 'list_price',
|
||||
'quantity', 'rec_name', 'template',
|
||||
'extra_tax', 'template.sale_price_w_tax',
|
||||
'write_date'])
|
||||
# if self._parent.cache_local:
|
||||
# clause = [
|
||||
# 'OR',
|
||||
# ('barcode', 'ilike', '%{:}%'.format(filter)),
|
||||
# ('code', 'ilike', '%{:}%'.format(filter)),
|
||||
# ('code', 'ilike', '%{:}%'.format(filter)),
|
||||
# ]
|
||||
# domain = [clause]
|
||||
# products = self._parent.local_db.find_product_elastic(domain, limit=100)
|
||||
# else:
|
||||
products = self._parent.Product.find(domain, ctx=self._parent.stock_context,
|
||||
fields=['name', 'code', 'description',
|
||||
'id', 'list_price',
|
||||
'quantity', 'rec_name', 'template',
|
||||
'extra_tax', 'template.sale_price_w_tax',
|
||||
'write_date'])
|
||||
|
||||
if not products:
|
||||
self._parent.message_bar.set('product_not_found')
|
||||
|
@ -1752,7 +1752,7 @@ class DialogInfoProduct(QuickDialog):
|
|||
grid = QGridLayout()
|
||||
_sizes = (160, 320)
|
||||
fields = (
|
||||
{'label': 'CODIGO', 'type': 'integer', 'readonly': False},
|
||||
{'label': 'CODIGO', 'type': 'integer', 'readonly': False},
|
||||
{'label': 'NOMBRE', 'type': 'char', 'readonly': False},
|
||||
)
|
||||
self.model = TableEdit(self, [], fields)
|
||||
|
|
|
@ -226,7 +226,7 @@ class FrontWindow(QMainWindow):
|
|||
'template.account_category'
|
||||
]
|
||||
}
|
||||
self.cache_local = self._config.get('cache_products_local')
|
||||
# self.cache_local = self._config.get('cache_products_local')
|
||||
|
||||
if self._config['show_location_pos']:
|
||||
_product['fields'].append('location_')
|
||||
|
|
42
app/main.py
42
app/main.py
|
@ -126,9 +126,9 @@ class AppWindow(FrontWindow):
|
|||
self.set_state('disabled')
|
||||
self.change_view_to('start_front')
|
||||
|
||||
if self.cache_local:
|
||||
self.set_cache_company()
|
||||
self.set_cache_products()
|
||||
# if self.cache_local:
|
||||
# self.set_cache_company()
|
||||
# self.set_cache_products()
|
||||
for j in self._journals:
|
||||
if j['id'] == self.default_journal['id']:
|
||||
self.default_journal = j
|
||||
|
@ -2712,25 +2712,23 @@ class AppWindow(FrontWindow):
|
|||
('barcode', '=', code),
|
||||
('code', '=', code)
|
||||
])
|
||||
if self.cache_local:
|
||||
clause = [
|
||||
'OR',
|
||||
# ('barcode', '=', '%{:}%'.format(code)),
|
||||
('code', '=', '%{:}%'.format(code)),
|
||||
]
|
||||
domain = [clause]
|
||||
products = self.local_db.find_product_elastic(domain, limit=100)
|
||||
else:
|
||||
products = self.Product.find(
|
||||
domain,
|
||||
# context=self.stock_context,
|
||||
fields=[
|
||||
'name', 'code', 'categories', 'description',
|
||||
'id', 'image', 'image_icon', 'list_price',
|
||||
'quantity', 'rec_name', 'template',
|
||||
'extra_tax', 'template.sale_price_w_tax',
|
||||
'template.default_uom', 'write_date']
|
||||
)
|
||||
# if self.cache_local:
|
||||
# clause = [
|
||||
# 'OR',
|
||||
# # ('barcode', '=', '%{:}%'.format(code)),
|
||||
# ('code', '=', '%{:}%'.format(code)),
|
||||
# ]
|
||||
# domain = [clause]
|
||||
# products = self.local_db.find_product_elastic(domain, limit=100)
|
||||
# else:
|
||||
products = self.Product.find(
|
||||
domain,
|
||||
fields=[
|
||||
'name', 'code', 'categories', 'description',
|
||||
'id', 'image', 'image_icon', 'list_price',
|
||||
'quantity', 'rec_name', 'template',
|
||||
'extra_tax', 'template.sale_price_w_tax',
|
||||
'template.default_uom', 'write_date'])
|
||||
|
||||
if not products or len(products) > 1:
|
||||
self.message_bar.set('product_not_found')
|
||||
|
|
Loading…
Reference in New Issue