bar code reading correction

This commit is contained in:
Elvis 2023-02-17 17:13:04 -05:00
parent c26377c6d7
commit 4aa72ad5a8
4 changed files with 22 additions and 13 deletions

View File

@ -1635,7 +1635,7 @@ class DialogInfoProduct(QuickDialog):
if self._parent.cache_local:
clause = [
'OR',
# ('barcode', 'ilike', '%{:}%'.format(filter)),
('barcode', 'ilike', '%{:}%'.format(filter)),
('code', 'ilike', '%{:}%'.format(filter)),
('code', 'ilike', '%{:}%'.format(filter)),
]

View File

@ -205,7 +205,6 @@ class AppWindow(FrontWindow):
'user': self.user,
'user_id': self._user['id'],
})
print(ctx_printing)
ctx_printing['row_characters'] = self.row_characters
ctx_printing['delta_locale'] = DELTA_LOCALE
locale_logo = ''
@ -732,6 +731,7 @@ class AppWindow(FrontWindow):
])
self.model_sale_lines.update_record(sale_line)
elif self._state in ['add', 'cancel', 'accept']:
print('si pasa junto al metodo clear_right_panel()')
self.clear_right_panel()
self.add_product(code=self._input_text)
elif self._state == 'payment':
@ -772,6 +772,7 @@ class AppWindow(FrontWindow):
self.buttons_stacked.show()
def action_read_weight(self):
print('si hace action_read_weight')
self.reader_thread.start()
def set_weight_readed(self):
@ -2259,7 +2260,8 @@ class AppWindow(FrontWindow):
'OR',
('template.name', 'ilike', '%{:}%'.format(tw)),
('description', 'ilike', '%{:}%'.format(tw)),
('code', 'ilike', '%{:}%'.format(tw))
('code', 'ilike', '%{:}%'.format(tw)),
('barcode', '=', '%{:}%'.format(tw))
]
domain.append(clause)
@ -2428,7 +2430,6 @@ class AppWindow(FrontWindow):
# FIXME ADD MORE
self._sale.update({'total_amount': 0})
self.store.set({'invoice_number': last_invoice_number})
self.label_input.setFocus()
self.party_id = self.default_party['id']
if self._sale.get('id') and self.field_delivery_charge:
if self.field_delivery_charge:
@ -2447,6 +2448,7 @@ class AppWindow(FrontWindow):
self.set_state('add')
if self.enviroment == 'restaurant':
self.action_source()
self.label_input.setFocus()
def _set_sale_date(self):
if self._sale.get('sale_date'):
@ -2465,7 +2467,6 @@ class AppWindow(FrontWindow):
('barcode', '=', code),
('code', '=', code)
])
if self.cache_local:
clause = [
'OR',
@ -2475,16 +2476,19 @@ class AppWindow(FrontWindow):
domain = [clause]
products = self.local_db.find_product_elastic(domain, limit=100)
else:
print('domain : ', domain)
print('este es el context ', self.stock_context)
products = self.Product.find(
domain,
ctx=self.stock_context,
# context=self.stock_context,
fields=[
'name', 'code', 'categories', 'description',
'id', 'image', 'image_icon', 'list_price', 'location'
'products_mix', 'quantity', 'rec_name', 'template',
'extra_tax', 'template.sale_price_w_tax', 'uom',
'write_date', 'encoded_sale_price']
'id', 'image', 'image_icon', 'list_price',
'quantity', 'rec_name', 'template',
'extra_tax', 'template.sale_price_w_tax',
'template.default_uom', 'write_date']
)
print('resultado ', products)
if not products or len(products) > 1:
self.message_bar.set('product_not_found')
@ -2563,7 +2567,13 @@ class AppWindow(FrontWindow):
ctx = None
if hasattr(self, 'field_list_price'):
ctx = {'price_list': self.field_list_price.get_id()}
res = self.Sale.faster_add_product(data, ctx=ctx)
kargs = {
'sale_id': data['sale_id'],
'product_id': data['product_id'],
'args': data,
'context': ctx
}
res = self.Sale.faster_add_product(data)
res['sale'] = self._sale['id']
self._sale_line = res
self._current_line_id = res['id']

View File

@ -140,7 +140,7 @@ MODELS_RESTAURANT = {
'template.sale_price_w_tax', 'template.account_category',
'quantity', 'list_price',
'sale_uom.name', 'categories',
'products_mix.code', 'products_mix.name'
# 'products_mix.code', 'products_mix.name'
],
'binaries': ['image']
},

View File

@ -170,7 +170,6 @@ class Model(object):
conn = self.conn(self.host, port=self.port, context=self.context_http)
else:
conn = self.conn(self.host, port=self.port)
conn.request(method, url, body=payload, headers=HEADERS)
response = conn.getresponse()
res = json.loads(response.read())