fixes in mode retail

This commit is contained in:
Wilson Gomez 2023-01-26 16:56:12 -05:00
parent af854c3eb5
commit 0ab1523254
5 changed files with 31 additions and 13 deletions

View File

@ -145,7 +145,10 @@ class TableModel(QAbstractTableModel):
for l in list_[:-1]:
l = l + '.'
data = data[l]
value = data[list_[-1]]
try:
value = data[list_[-1]]
except:
print(data, field)
return value
def data(self, index, role, field_name='name'):

View File

@ -601,9 +601,9 @@ class DialogSaleForm(QuickDialog):
res = self._parent.Sale.duplicate_sale({
'sale_id': self.sale_customer_selected,
})
self.dialog_search_consumer.close()
self.dialog_table_sale_consumer.close()
self.dialog_sale_consumer_selected.close()
self.parent.dialog_consumer.close()
self.parent.dialog_historic_sales.close()
self.close()
return res

View File

@ -43,7 +43,7 @@ import time
invoice_type = []
_SALE_HISTORIC = [
'party.name', 'sale_date', 'number', 'invoice_number', 'consumer',
'party.name', 'sale_date', 'number', 'invoice_number', 'consumer.name',
'total_amount_cache', 'lines.quantity', 'lines.product.name', 'lines.unit.symbol',
'lines.amount', 'lines.unit_price_w_tax', 'lines.amount_w_tax',
'lines.product.template.name', 'lines.note'
@ -803,7 +803,8 @@ class AppWindow(FrontWindow):
try:
product_id = self._sale_line['product.']['id']
except:
product_id = self._sale_line['product']
product_id = self._sale_line['product']['id']
print(product_id, 'this is product id', self._sale_line)
if product_id and self.stock_context:
_product, = self.Product.find(
[('id', '=', product_id)],
@ -825,7 +826,8 @@ class AppWindow(FrontWindow):
if hasattr(self, 'field_list_price') and self._config.get('use_price_list'):
ctx = {'price_list': self.field_list_price.get_id()}
rec = self.SaleLine.faster_set_quantity(args, ctx=ctx)
except:
except Exception as e:
print(e)
return self.message_bar.set('quantity_not_valid')
self.message_bar.set('system_ready')
@ -1085,7 +1087,9 @@ class AppWindow(FrontWindow):
if not self._sale['id'] or not self.model_sale_lines.rowCount() > 0:
return
if self.enviroment == 'retail':
self.Sale.quote({'id': self._sale['id']})
print('ingresa a este')
self.Sale.button_method('quote', [self._sale['id']])
print('no conitnua')
self.load_sale(self._sale['id'])
self.set_state('accept')
@ -1421,7 +1425,8 @@ class AppWindow(FrontWindow):
return
if self._sale.get('state') == 'draft':
self.Sale.quote({'id': self._sale['id']})
self.Sale.button_method('quote', [self._sale['id']])
# self.Sale.quote({'id': self._sale['id']})
self.load_sale(self._sale['id'])
if self._sale.get('state') == 'quotation':
@ -1433,7 +1438,7 @@ class AppWindow(FrontWindow):
res = self.dialog_advance.exec_()
amount = self.field_amount_ask.text()
reservation = self.field_reservation_ask.isChecked()
if res == 0 or (res==1 and amount.isdigit()):
if res == 0 or (res == 1 and amount.isdigit()):
flag = False
if res == 1:
journal = self.journal
@ -1732,7 +1737,6 @@ class AppWindow(FrontWindow):
kind = 'dispatch'
if self.enviroment == 'restaurant':
kind = 'command'
print('sale', self._sale)
if not sale_id and self._sale['id']:
sale_id = self._sale['id']
result = self._print_order(sale_id, kind)
@ -1839,7 +1843,7 @@ class AppWindow(FrontWindow):
self.dialog_historic_sales.exec_()
def action_search_sale(self):
self.print_no_commanded()
# self.print_no_commanded()
self.dialog_search_sales.show()
self.search_sales_by_domain()
self.field_invoice_type.set_enabled(True)

View File

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

View File

@ -180,6 +180,18 @@ class Model(object):
}
res = self.get_connection('POST', '/method', args_)
return res
def button_method(self, method, ids=[], ctx=None):
if ctx:
self.ctx.update(ctx)
args_ = {
'model': self.model,
'method': method,
'ids': ids,
'context': self.ctx,
}
res = self.get_connection('POST', '/button_method', args_)
return res
# route = self.get_route('method')
# data = json.dumps(args_, default=encoder)
# res = requests.post(route, data=data)